Home  >  Article  >  Backend Development  >  Why does artificial intelligence use python?

Why does artificial intelligence use python?

步履不停
步履不停Original
2019-07-03 11:12:154037browse

Why does artificial intelligence use python?

This is a misunderstanding. The core algorithm of artificial intelligence is completely dependent on C/C. Because it is computationally intensive, it requires very fine optimization, and also requires GPU and dedicated hardware. Such interfaces can only be done by C/C. So in a sense, C/C is actually the most important language in the field of artificial intelligence.

Python is the API binding of these libraries. Python is used because of the glue language characteristics of CPython. To develop a cross-language interface from other languages ​​to C/C, Python is the easiest, and it is more difficult than other languages. It's much lower, especially when using Cython. Many ffi in other languages ​​can only import C function entry points, and most complex data structures can only be put together manually using byte arrays. If callback function input is also needed, there is nothing you can do. CPython's C API is bidirectionally integrated, and can directly expose encapsulated Python objects to the outside world. It can also allow users to introduce new features by inheriting these custom objects, and even call Python functions from C code (of course, there are also certain conditions). But this is also an obstacle for JIT interpreters like PyPy.

Moreover, Python has always been an important tool for scientific computing and data analysis in history. With a foundation like numpy, because the industries are similar, Python is the first choice when choosing an API binding language, and at the same time, the foundation like numpy is reused. The library not only reduces the development workload, but also makes it easier for practitioners to get started.

Related tutorial recommendations: Python video tutorial

The above is the detailed content of Why does artificial intelligence use python?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn