Import tf.keras
tf.keras
is TensorFlow's implementation of the Keras API specification. This is a high-level API to build and train models that includes first-class support for TensorFlow-specific functionality, such as eager execution, tf.data
pipelines, and Estimators. tf.keras
makes TensorFlow easier to use without sacrificing flexibility and performance.
为了能够更好地应用TensorFlow中各种功能——如eager execution、tf.data管道和Estimators——构建、训练模型,TensorFlow根据Keras API的说明对其进行了封装和实现,将其命名为tf.keras。tf.keras是keras更高级的API封装,这使得TensorFlow在兼顾灵活性和高效性的同时,操作起来更加简单。
To get started, import tf.keras
as part of your TensorFlow program setup:
from __future__ import absolute_import, division, print_function, unicode_literals
#Python3.X可以不用输入上面这句
import tensorflow as tf
from tensorflow import keras
tf.keras
can run any Ker