简体   繁体   English

Python - TensorFlow 和 Keras

[英]Python - TensorFlow and Keras

I've been searching all about What is Tensorflow and Keras.我一直在搜索什么是 Tensorflow 和 Keras。 They say that Tensorflow runs on top of Keras which means that Tensorflow is the "BACKEND" of KERAS.他们说 Tensorflow 在 Keras 之上运行,这意味着 Tensorflow 是 Z7E7904ACCF4D2E5FBE843F 的“后端”。 (Although you can use others like Theano and CNTK) (尽管您可以使用 Theano 和 CNTK 等其他工具)

Does the "BACKEND" term here mean it does the whole mathematical process thing behind a deep learning model?这里的“BACKEND”一词是否意味着它完成了深度学习 model 背后的整个数学过程? What I mean is like Tensorflow is the one who does the complicated stuffs like processing the matrices (tensor), doing all the math stuff?我的意思是 Tensorflow 是做复杂事情的人,比如处理矩阵(张量),做所有的数学事情?

On the other hand KERAS is the guy that is needed ONLY for us to create a MODEL, right?另一方面,KERAS 是我们只需要创建 MODEL 的人,对吧? and ONCE the model is created, its "BACKEND" is Tensorflow, right?并且一旦创建了 model,它的“BACKEND”就是 Tensorflow,对吧? cause for the MODEL TO WORK AS IT SHOULD BE (like process matrices and do all the math stuffs) it needs a "BACKEND" which is Tensorflow.导致 MODEL 按其应有的方式工作(如处理矩阵并进行所有数学运算)它需要一个“BACKEND”,即 Tensorflow。

That is what I understand based on some open forums and the Keras documentation :这就是我根据一些开放论坛和 Keras 文档所理解的:

Keras is a model-level library, providing high-level building blocks for developing deep learning models. Keras 是一个模型级库,为开发深度学习模型提供高级构建块。 It does not handle itself low-level operations such as tensor products, convolutions and so on.它不处理自己的低级操作,例如张量积、卷积等。 Instead, it relies on a specialized, well-optimized tensor manipulation library to do so, serving as the “backend engine” of Keras.相反,它依赖于专门的、优化良好的张量操作库来执行此操作,充当 Keras 的“后端引擎”。

Is my understanding correct?我的理解正确吗? Please enlighten me if you have other answers.如果您有其他答案,请赐教。

When we say that Tensorflow is the backend of Keras, we mean that Keras do not do calculations by itself.当我们说 Tensorflow 是 Keras 的后端时,我们的意思是 Keras 不自己做计算。 Keras just provide easy to use functions that use more complex Tensorflow code. Keras 仅提供使用更复杂的 Tensorflow 代码的易于使用的功能。 It is then a little less powerful but it is sufficient in most cases.然后它的功能稍弱,但在大多数情况下就足够了。 And when it is not, you can add Tensorflow code in your Keras Code as they both use The same Tensorflow objects in background.如果不是,您可以在 Keras 代码中添加 Tensorflow 代码,因为它们都在后台使用相同的 Tensorflow 对象。

Keras is now the official Tensorflow High level API, it is then a part of Tensorflow. Keras 现在是官方的 Tensorflow 高级 API,然后是 ZCB20B802A3F0255E054E4FB8ED 的一部分。

As of a greater version of TensorFlow (1.8) and all the later + latest versions of TensorFlow, Keras is integrated inside TensorFlow.从更高版本的 TensorFlow (1.8) 和所有更高版本 + 最新版本的 TensorFlow 开始,Keras 集成在 Z0734DD6997310DAE888EEB45F13B3B 中

The recommended way to use Keras is to use it inside TensorFlow, practically if you import a layer you should do like from tensorflow.keras import X, Y . The recommended way to use Keras is to use it inside TensorFlow, practically if you import a layer you should do like from tensorflow.keras import X, Y .

Keras indeed is a high-level API which supports multiple back-end frameworks, such as Theano(which is obsolete by the way) or MXNET etc. Keras 确实是一个高级的 API,它支持多个后端框架,例如 Theano(顺便说一句已经过时)或 MXNET 等。

Since Keras was easier to use and a lot of people opted for Keras in spite of TensorFlow, whose learning curve was very poor in comparison with Keras, TensorFlow decided to integrate Keras inside their framework. Since Keras was easier to use and a lot of people opted for Keras in spite of TensorFlow, whose learning curve was very poor in comparison with Keras, TensorFlow decided to integrate Keras inside their framework.

Practically, in the meantime, the creator of Keras became part of the Google development team, hence the integration of Keras inside TensorFlow.实际上,与此同时,Keras 的创建者加入了 Google 开发团队,因此将 Keras 集成到 TensorFlow 中。

If you are just staring with deep learning, ensure that you are using Keras inside TensorFlow .如果您只是关注深度学习,请确保您在 TensorFlow 中使用 Keras It is more robust, less prone to errors.它更健壮,更不容易出错。 In addition to this, Keras will enter maintenance mode (as of 2.3.X) no major version will be released anymore, only maintenance.除此之外,Keras 将进入维护模式(从 2.3.X 开始)不再发布主要版本,仅维护。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM