Type Model
Namespace tensorflow.keras
Parent Network
Interfaces IModel
`Model` groups layers into an object with training and inference features. There are two ways to instantiate a `Model`: 1 - With the "functional API", where you start from `Input`,
you chain layer calls to specify the model's forward pass,
and finally you create your model from inputs and outputs:
2 - By subclassing the `Model` class: in that case, you should define your
layers in `__init__` and you should implement the model's forward pass
in `call`.
If you subclass `Model`, you can optionally have
a `training` argument (boolean) in `call`, which you can use to specify
a different behavior in training and inference:
Show Example
import tensorflow as tf inputs = tf.keras.Input(shape=(3,)) x = tf.keras.layers.Dense(4, activation=tf.nn.relu)(inputs) outputs = tf.keras.layers.Dense(5, activation=tf.nn.softmax)(x) model = tf.keras.Model(inputs=inputs, outputs=outputs)
Properties
- activity_regularizer
- activity_regularizer_dyn
- built
- dtype
- dtype_dyn
- dynamic
- dynamic_dyn
- inbound_nodes
- inbound_nodes_dyn
- input
- input_dyn
- input_mask
- input_mask_dyn
- input_names
- input_shape
- input_shape_dyn
- input_spec
- input_spec_dyn
- inputs
- layers
- layers_dyn
- loss
- loss_functions
- loss_weights
- losses
- losses_dyn
- metrics
- metrics_dyn
- metrics_names
- metrics_names_dyn
- name
- name_dyn
- name_scope
- name_scope_dyn
- non_trainable_variables
- non_trainable_variables_dyn
- non_trainable_weights
- non_trainable_weights_dyn
- optimizer
- outbound_nodes
- outbound_nodes_dyn
- output
- output_dyn
- output_mask
- output_mask_dyn
- output_names
- output_shape
- output_shape_dyn
- outputs
- predict_function
- PythonObject
- run_eagerly
- run_eagerly_dyn
- sample_weight_mode
- sample_weights
- sample_weights_dyn
- state_updates
- state_updates_dyn
- stateful
- stateful_dyn
- submodules
- submodules_dyn
- supports_masking
- test_function
- total_loss
- train_function
- trainable
- trainable_dyn
- trainable_variables
- trainable_variables_dyn
- trainable_weights
- trainable_weights_dyn
- updates
- updates_dyn
- variables
- variables_dyn
- weights
- weights_dyn
Public properties
PythonFunctionContainer activity_regularizer get; set;
object activity_regularizer_dyn get; set;
bool built get; set;
object dtype get;
object dtype_dyn get;
bool dynamic get;
object dynamic_dyn get;
IList<Node> inbound_nodes get;
object inbound_nodes_dyn get;
IList<object> input get;
object input_dyn get;
object input_mask get;
object input_mask_dyn get;
IList<object> input_names get; set;
IList<object> input_shape get;
object input_shape_dyn get;
object input_spec get; set;
object input_spec_dyn get;
IList<object> inputs get; set;
IList<Layer> layers get;
object layers_dyn get;
object loss get; set;
IList<object> loss_functions get; set;
IList<double> loss_weights get; set;
IList<object> losses get;
object losses_dyn get;
IList<object> metrics get;
Returns the model's metrics added using `compile`, `add_metric` APIs.
object metrics_dyn get;
Returns the model's metrics added using `compile`, `add_metric` APIs.
IList<object> metrics_names get;
Returns the model's display labels for all outputs.
object metrics_names_dyn get;
Returns the model's display labels for all outputs.
object name get;
object name_dyn get;
object name_scope get;
object name_scope_dyn get;
IList<object> non_trainable_variables get;
object non_trainable_variables_dyn get;
IList<object> non_trainable_weights get;
object non_trainable_weights_dyn get;
object optimizer get; set;
IList<object> outbound_nodes get;
object outbound_nodes_dyn get;
IList<object> output get;
object output_dyn get;
object output_mask get;
object output_mask_dyn get;
IList<object> output_names get; set;
object output_shape get;
object output_shape_dyn get;
IList<object> outputs get; set;
object predict_function get; set;
object PythonObject get;
Nullable<bool> run_eagerly get; set;
Settable attribute indicating whether the model should run eagerly. Running eagerly means that your model will be run step by step,
like Python code. Your model might run slower, but it should become easier
for you to debug it by stepping into individual layer calls. By default, we will attempt to compile your model to a static graph to
deliver the best execution performance.
object run_eagerly_dyn get; set;
Settable attribute indicating whether the model should run eagerly. Running eagerly means that your model will be run step by step,
like Python code. Your model might run slower, but it should become easier
for you to debug it by stepping into individual layer calls. By default, we will attempt to compile your model to a static graph to
deliver the best execution performance.