简体   繁体   English

在TF2.0中,`tf.keras.Model.compile`有什么作用?

[英]What does `tf.keras.Model.compile` do in TF2.0?

In TF2.0, it is still necessary to call model.compile after creating a keras model, as seen in the doc . 在TF2.0中,仍然需要在创建keras模型之后调用model.compile ,如doc中所示

But with eager mode, there is no need for graph creation, so what is the use of tf.keras.Model.compile in Tensorflow 2.0? 但随着渴望模式,就没有必要对图表生成,所以有什么用的tf.keras.Model.compile在Tensorflow 2.0吗?

model.compile has nothing to do with graph mode, it defines the loss, optimizer, and metrics, same as with keras and tf.keras in TF 1.x. model.compile与图模式无关,它定义了损耗,优化器和指标,与TF 1.x中的kerastf.keras相同。 The graph is just an internal detail that is not really related to model.compile . 该图只是一个内部细节,实际上与model.compile

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

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