Tensorflow Keras tutotrials01
tf.keras.Sequential
groups a linear stack Models into Sequential
Here are quick starts for the beginners and experts respectively: MINIST Recongnization
So, the key point of the programming is about how to build the Model. Here, we build tf.keras model using subclass tf.keras.Sequential.
Then,we talk about how to use Sequential model:
A Sequential model is appropriate for a plain stack of layers where each layer has exactly one input tensor and one output tensor.
Schematically, the following Sequential model:
# Define Sequential model with 3 layers model = keras.Sequential( [ layers.Dense(2, activation="relu", name="layer1"), layers.Dense(3, activation="relu", name="layer2"), layers.Dense(4, name="layer3"), ] ) # Call model on a test input x = tf.ones((3, 3)) y = model(x)
Denseimplements the operation:output = activation(dot(input, kernel) + bias)whereactivationis the element-wise activation function passed as theactivationargument,kernelis a weights matrix created by the layer, andbiasis a bias vector created by the layer (only applicable ifuse_biasisTrue).
ArgumentsN-D tensor with shape: Output shape:N-D tensor with shape: *relationship between tensorflow and keras 相关 |
|---|