Type LSTMPredictionModel
Namespace tensorflow_estimator.python.estimator.canned.timeseries.ar_model
Parent Model
Interfaces ILSTMPredictionModel
Methods
- __call__
- __call__
- __call__
- __call__
- __call___dyn
- __call___dyn
- add_loss
- add_loss
- add_loss
- add_loss
- add_variable
- add_variable
- add_variable_dyn
- add_variable_dyn
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight_dyn
- apply
- apply
- apply
- apply
- apply
- apply
- apply_dyn
- apply_dyn
- build
- build
- build_dyn
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call
- call_dyn
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compile
- compute_mask
- compute_mask
- compute_mask
- compute_mask
- compute_mask_dyn
- compute_output_shape
- compute_output_shape_dyn
- compute_output_signature
- compute_output_signature
- compute_output_signature_dyn
- count_params
- count_params_dyn
- evaluate
- evaluate
- evaluate
- evaluate
- evaluate
- evaluate
- evaluate
- evaluate
- evaluate
- evaluate
- evaluate_dyn
- evaluate_generator
- evaluate_generator_dyn
- fit
- fit
- fit
- fit
- fit
- fit
- fit
- fit
- fit
- fit
- fit
- fit
- fit
- fit_generator
- fit_generator
- fit_generator
- fit_generator_dyn
- get_input_at
- get_input_at_dyn
- get_input_mask_at
- get_input_mask_at_dyn
- get_input_shape_at
- get_input_shape_at_dyn
- get_layer
- get_layer_dyn
- get_losses_for
- get_losses_for
- get_losses_for
- get_losses_for_dyn
- get_output_at
- get_output_at_dyn
- get_output_mask_at
- get_output_mask_at_dyn
- get_output_shape_at
- get_output_shape_at_dyn
- get_weights_
- get_weights_dyn_
- predict
- predict
- predict
- predict
- predict
- predict
- predict
- predict
- predict_dyn
- predict_generator
- predict_generator_dyn
- reset_metrics
- reset_metrics_dyn
- reset_states
- reset_states_dyn
- save
- save
- save
- test_on_batch
- test_on_batch
- test_on_batch
- test_on_batch
- test_on_batch
- test_on_batch
- test_on_batch
- test_on_batch
- test_on_batch
- test_on_batch
- test_on_batch
- test_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch
- train_on_batch_dyn
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 instance methods
object __call__(IEnumerable<IGraphNodeBase> inputs, IDictionary<string, object> kwargs, IGraphNodeBase[] args)
Wraps `call`, applying pre- and post-processing steps.
Parameters
-
IEnumerable<IGraphNodeBase>inputs - input tensor(s).
-
IDictionary<string, object>kwargs - additional keyword arguments to be passed to `self.call`.
-
IGraphNodeBase[]args - additional positional arguments to be passed to `self.call`.
Returns
-
object - Output tensor(s). Note: - The following optional keyword arguments are reserved for specific uses: * `training`: Boolean scalar tensor of Python boolean indicating whether the `call` is meant for training or inference. * `mask`: Boolean input mask. - If the layer's `call` method takes a `mask` argument (as some Keras layers do), its default value will be set to the mask generated for `inputs` by the previous layer (if `input` did come from a layer that generated a corresponding mask, i.e. if it came from a Keras layer with masking support.
object __call__(IEnumerable<IGraphNodeBase> inputs, IGraphNodeBase[] args)
Wraps `call`, applying pre- and post-processing steps.
Parameters
-
IEnumerable<IGraphNodeBase>inputs - input tensor(s).
-
IGraphNodeBase[]args - additional positional arguments to be passed to `self.call`.
Returns
-
object - Output tensor(s). Note: - The following optional keyword arguments are reserved for specific uses: * `training`: Boolean scalar tensor of Python boolean indicating whether the `call` is meant for training or inference. * `mask`: Boolean input mask. - If the layer's `call` method takes a `mask` argument (as some Keras layers do), its default value will be set to the mask generated for `inputs` by the previous layer (if `input` did come from a layer that generated a corresponding mask, i.e. if it came from a Keras layer with masking support.
object __call__(IGraphNodeBase inputs, IDictionary<string, object> kwargs, IGraphNodeBase[] args)
Wraps `call`, applying pre- and post-processing steps.
Parameters
-
IGraphNodeBaseinputs - input tensor(s).
-
IDictionary<string, object>kwargs - additional keyword arguments to be passed to `self.call`.
-
IGraphNodeBase[]args - additional positional arguments to be passed to `self.call`.
Returns
-
object - Output tensor(s). Note: - The following optional keyword arguments are reserved for specific uses: * `training`: Boolean scalar tensor of Python boolean indicating whether the `call` is meant for training or inference. * `mask`: Boolean input mask. - If the layer's `call` method takes a `mask` argument (as some Keras layers do), its default value will be set to the mask generated for `inputs` by the previous layer (if `input` did come from a layer that generated a corresponding mask, i.e. if it came from a Keras layer with masking support.
object __call__(IGraphNodeBase inputs, IGraphNodeBase[] args)
Wraps `call`, applying pre- and post-processing steps.
Parameters
-
IGraphNodeBaseinputs - input tensor(s).
-
IGraphNodeBase[]args - additional positional arguments to be passed to `self.call`.
Returns
-
object - Output tensor(s). Note: - The following optional keyword arguments are reserved for specific uses: * `training`: Boolean scalar tensor of Python boolean indicating whether the `call` is meant for training or inference. * `mask`: Boolean input mask. - If the layer's `call` method takes a `mask` argument (as some Keras layers do), its default value will be set to the mask generated for `inputs` by the previous layer (if `input` did come from a layer that generated a corresponding mask, i.e. if it came from a Keras layer with masking support.
object __call___dyn(object inputs, Object[] args)
Wraps `call`, applying pre- and post-processing steps.
Parameters
-
objectinputs - input tensor(s).
-
Object[]args - additional positional arguments to be passed to `self.call`.
Returns
-
object - Output tensor(s). Note: - The following optional keyword arguments are reserved for specific uses: * `training`: Boolean scalar tensor of Python boolean indicating whether the `call` is meant for training or inference. * `mask`: Boolean input mask. - If the layer's `call` method takes a `mask` argument (as some Keras layers do), its default value will be set to the mask generated for `inputs` by the previous layer (if `input` did come from a layer that generated a corresponding mask, i.e. if it came from a Keras layer with masking support.
object __call___dyn(object inputs, IDictionary<string, object> kwargs, Object[] args)
Wraps `call`, applying pre- and post-processing steps.
Parameters
-
objectinputs - input tensor(s).
-
IDictionary<string, object>kwargs - additional keyword arguments to be passed to `self.call`.
-
Object[]args - additional positional arguments to be passed to `self.call`.
Returns
-
object - Output tensor(s). Note: - The following optional keyword arguments are reserved for specific uses: * `training`: Boolean scalar tensor of Python boolean indicating whether the `call` is meant for training or inference. * `mask`: Boolean input mask. - If the layer's `call` method takes a `mask` argument (as some Keras layers do), its default value will be set to the mask generated for `inputs` by the previous layer (if `input` did come from a layer that generated a corresponding mask, i.e. if it came from a Keras layer with masking support.
void add_loss(PythonFunctionContainer losses, bool inputs)
Add loss tensor(s), potentially dependent on layer inputs. Some losses (for instance, activity regularization losses) may be dependent
on the inputs passed when calling a layer. Hence, when reusing the same
layer on different inputs `a` and `b`, some entries in `layer.losses` may
be dependent on `a` and some on `b`. This method automatically keeps track
of dependencies. This method can be used inside a subclassed layer or model's `call`
function, in which case `losses` should be a Tensor or list of Tensors. Example:
This method can also be called directly on a Functional Model during
construction. In this case, any loss Tensors passed to this Model must
be symbolic and be able to be traced back to the model's `Input`s. These
losses become part of the model's topology and are tracked in `get_config`. Example:
If this is not the case for your loss (if, for example, your loss references
a `Variable` of one of the model's layers), you can wrap your loss in a
zero-argument lambda. These losses are not tracked as part of the model's
topology since they can't be serialized. Example:
The `get_losses_for` method allows to retrieve the losses relevant to a
specific set of inputs.
Parameters
-
PythonFunctionContainerlosses - Loss tensor, or list/tuple of tensors. Rather than tensors, losses may also be zero-argument callables which create a loss tensor.
-
boolinputs - Ignored when executing eagerly. If anything other than None is passed, it signals the losses are conditional on some of the layer's inputs, and thus they should only be run where these inputs are available. This is the case for activity regularization losses, for instance. If `None` is passed, the losses are assumed to be unconditional, and will apply across all dataflows of the layer (e.g. weight regularization losses).
Show Example
class MyLayer(tf.keras.layers.Layer):
def call(inputs, self):
self.add_loss(tf.abs(tf.reduce_mean(inputs)), inputs=True)
return inputs
void add_loss(IEnumerable<IGraphNodeBase> losses, IGraphNodeBase inputs)
Add loss tensor(s), potentially dependent on layer inputs. Some losses (for instance, activity regularization losses) may be dependent
on the inputs passed when calling a layer. Hence, when reusing the same
layer on different inputs `a` and `b`, some entries in `layer.losses` may
be dependent on `a` and some on `b`. This method automatically keeps track
of dependencies. This method can be used inside a subclassed layer or model's `call`
function, in which case `losses` should be a Tensor or list of Tensors. Example:
This method can also be called directly on a Functional Model during
construction. In this case, any loss Tensors passed to this Model must
be symbolic and be able to be traced back to the model's `Input`s. These
losses become part of the model's topology and are tracked in `get_config`. Example:
If this is not the case for your loss (if, for example, your loss references
a `Variable` of one of the model's layers), you can wrap your loss in a
zero-argument lambda. These losses are not tracked as part of the model's
topology since they can't be serialized. Example:
The `get_losses_for` method allows to retrieve the losses relevant to a
specific set of inputs.
Parameters
-
IEnumerable<IGraphNodeBase>losses - Loss tensor, or list/tuple of tensors. Rather than tensors, losses may also be zero-argument callables which create a loss tensor.
-
IGraphNodeBaseinputs - Ignored when executing eagerly. If anything other than None is passed, it signals the losses are conditional on some of the layer's inputs, and thus they should only be run where these inputs are available. This is the case for activity regularization losses, for instance. If `None` is passed, the losses are assumed to be unconditional, and will apply across all dataflows of the layer (e.g. weight regularization losses).
Show Example
class MyLayer(tf.keras.layers.Layer):
def call(inputs, self):
self.add_loss(tf.abs(tf.reduce_mean(inputs)), inputs=True)
return inputs
void add_loss(IEnumerable<IGraphNodeBase> losses, IEnumerable<IGraphNodeBase> inputs)
Add loss tensor(s), potentially dependent on layer inputs. Some losses (for instance, activity regularization losses) may be dependent
on the inputs passed when calling a layer. Hence, when reusing the same
layer on different inputs `a` and `b`, some entries in `layer.losses` may
be dependent on `a` and some on `b`. This method automatically keeps track
of dependencies. This method can be used inside a subclassed layer or model's `call`
function, in which case `losses` should be a Tensor or list of Tensors. Example:
This method can also be called directly on a Functional Model during
construction. In this case, any loss Tensors passed to this Model must
be symbolic and be able to be traced back to the model's `Input`s. These
losses become part of the model's topology and are tracked in `get_config`. Example:
If this is not the case for your loss (if, for example, your loss references
a `Variable` of one of the model's layers), you can wrap your loss in a
zero-argument lambda. These losses are not tracked as part of the model's
topology since they can't be serialized. Example:
The `get_losses_for` method allows to retrieve the losses relevant to a
specific set of inputs.
Parameters
-
IEnumerable<IGraphNodeBase>losses - Loss tensor, or list/tuple of tensors. Rather than tensors, losses may also be zero-argument callables which create a loss tensor.
-
IEnumerable<IGraphNodeBase>inputs - Ignored when executing eagerly. If anything other than None is passed, it signals the losses are conditional on some of the layer's inputs, and thus they should only be run where these inputs are available. This is the case for activity regularization losses, for instance. If `None` is passed, the losses are assumed to be unconditional, and will apply across all dataflows of the layer (e.g. weight regularization losses).
Show Example
class MyLayer(tf.keras.layers.Layer):
def call(inputs, self):
self.add_loss(tf.abs(tf.reduce_mean(inputs)), inputs=True)
return inputs
void add_loss(IEnumerable<IGraphNodeBase> losses, bool inputs)
Add loss tensor(s), potentially dependent on layer inputs. Some losses (for instance, activity regularization losses) may be dependent
on the inputs passed when calling a layer. Hence, when reusing the same
layer on different inputs `a` and `b`, some entries in `layer.losses` may
be dependent on `a` and some on `b`. This method automatically keeps track
of dependencies. This method can be used inside a subclassed layer or model's `call`
function, in which case `losses` should be a Tensor or list of Tensors. Example:
This method can also be called directly on a Functional Model during
construction. In this case, any loss Tensors passed to this Model must
be symbolic and be able to be traced back to the model's `Input`s. These
losses become part of the model's topology and are tracked in `get_config`. Example:
If this is not the case for your loss (if, for example, your loss references
a `Variable` of one of the model's layers), you can wrap your loss in a
zero-argument lambda. These losses are not tracked as part of the model's
topology since they can't be serialized. Example:
The `get_losses_for` method allows to retrieve the losses relevant to a
specific set of inputs.
Parameters
-
IEnumerable<IGraphNodeBase>losses - Loss tensor, or list/tuple of tensors. Rather than tensors, losses may also be zero-argument callables which create a loss tensor.
-
boolinputs - Ignored when executing eagerly. If anything other than None is passed, it signals the losses are conditional on some of the layer's inputs, and thus they should only be run where these inputs are available. This is the case for activity regularization losses, for instance. If `None` is passed, the losses are assumed to be unconditional, and will apply across all dataflows of the layer (e.g. weight regularization losses).
Show Example
class MyLayer(tf.keras.layers.Layer):
def call(inputs, self):
self.add_loss(tf.abs(tf.reduce_mean(inputs)), inputs=True)
return inputs
object add_variable(IDictionary<string, object> kwargs, Object[] args)
object add_variable(Object[] args)
object add_variable_dyn(Object[] args)
object add_variable_dyn(IDictionary<string, object> kwargs, Object[] args)
object add_weight(string name, ValueTuple shape, DType dtype, PythonClassContainer initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
ValueTupleshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
PythonClassContainerinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
IDictionary<object, object>constraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, ValueTuple shape, DType dtype, PythonClassContainer initializer, object regularizer, object trainable, object constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
ValueTupleshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
PythonClassContainerinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
objectconstraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, TensorShape shape, DType dtype, object initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
TensorShapeshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
objectinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
IDictionary<object, object>constraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, TensorShape shape, DType dtype, object initializer, object regularizer, object trainable, object constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
TensorShapeshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
objectinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
objectconstraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, ValueTuple shape, DType dtype, object initializer, object regularizer, object trainable, object constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
ValueTupleshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
objectinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
objectconstraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, TensorShape shape, DType dtype, PythonClassContainer initializer, object regularizer, object trainable, object constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
TensorShapeshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
PythonClassContainerinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
objectconstraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, TensorShape shape, DType dtype, PythonClassContainer initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
TensorShapeshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
PythonClassContainerinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
IDictionary<object, object>constraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, Dimension shape, DType dtype, object initializer, object regularizer, object trainable, object constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
Dimensionshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
objectinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
objectconstraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, Dimension shape, DType dtype, object initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
Dimensionshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
objectinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
IDictionary<object, object>constraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, ValueTuple shape, DType dtype, object initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
ValueTupleshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
objectinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
IDictionary<object, object>constraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, int shape, DType dtype, PythonClassContainer initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
intshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
PythonClassContainerinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
IDictionary<object, object>constraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, Dimension shape, DType dtype, PythonClassContainer initializer, object regularizer, object trainable, object constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
Dimensionshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
PythonClassContainerinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
objectconstraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, Dimension shape, DType dtype, PythonClassContainer initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
Dimensionshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
PythonClassContainerinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
IDictionary<object, object>constraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, int shape, DType dtype, object initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
intshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
objectinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
IDictionary<object, object>constraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, int shape, DType dtype, object initializer, object regularizer, object trainable, object constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
intshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
objectinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
objectconstraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight(string name, int shape, DType dtype, PythonClassContainer initializer, object regularizer, object trainable, object constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
stringname - Variable name.
-
intshape - Variable shape. Defaults to scalar if unspecified.
-
DTypedtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
PythonClassContainerinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
objectconstraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object add_weight_dyn(object name, object shape, object dtype, object initializer, object regularizer, object trainable, object constraint, object partitioner, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, IDictionary<string, object> kwargs)
Adds a new variable to the layer.
Parameters
-
objectname - Variable name.
-
objectshape - Variable shape. Defaults to scalar if unspecified.
-
objectdtype - The type of the variable. Defaults to `self.dtype` or `float32`.
-
objectinitializer - Initializer instance (callable).
-
objectregularizer - Regularizer instance (callable).
-
objecttrainable - Boolean, whether the variable should be part of the layer's "trainable_variables" (e.g. variables, biases) or "non_trainable_variables" (e.g. BatchNorm mean and variance). Note that `trainable` cannot be `True` if `synchronization` is set to `ON_READ`.
-
objectconstraint - Constraint instance (callable).
-
objectpartitioner - Partitioner to be passed to the `Trackable` API.
-
objectuse_resource - Whether to use `ResourceVariable`.
-
ImplicitContainer<T>synchronization - Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
tf.VariableSynchronization. By default the synchronization is set to `AUTO` and the current `DistributionStrategy` chooses when to synchronize. If `synchronization` is set to `ON_READ`, `trainable` must not be set to `True`. -
ImplicitContainer<T>aggregation - Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
tf.VariableAggregation. -
IDictionary<string, object>kwargs - Additional keyword arguments. Accepted values are `getter` and `collections`.
Returns
-
object - The created variable. Usually either a `Variable` or `ResourceVariable` instance. If `partitioner` is not `None`, a `PartitionedVariable` instance is returned.
object apply(PythonFunctionContainer inputs, IDictionary<string, object> kwargs, Object[] args)
object apply(IEnumerable<IGraphNodeBase> inputs, IDictionary<string, object> kwargs, Object[] args)
object apply(IEnumerable<IGraphNodeBase> inputs, Object[] args)
object apply(PythonFunctionContainer inputs, Object[] args)
object apply(object inputs, IDictionary<string, object> kwargs, Object[] args)
object apply(object inputs, Object[] args)
object apply_dyn(object inputs, Object[] args)
object apply_dyn(object inputs, IDictionary<string, object> kwargs, Object[] args)
void build(PythonClassContainer input_shape)
Creates the variables of the layer (optional, for subclass implementers). This is a method that implementers of subclasses of `Layer` or `Model`
can override if they need a state-creation step in-between
layer instantiation and layer call. This is typically used to create the weights of `Layer` subclasses.
Parameters
-
PythonClassContainerinput_shape - Instance of `TensorShape`, or list of instances of `TensorShape` if the layer expects a list of inputs (one instance per input).
void build(object input_shape)
Creates the variables of the layer (optional, for subclass implementers). This is a method that implementers of subclasses of `Layer` or `Model`
can override if they need a state-creation step in-between
layer instantiation and layer call. This is typically used to create the weights of `Layer` subclasses.
Parameters
-
objectinput_shape - Instance of `TensorShape`, or list of instances of `TensorShape` if the layer expects a list of inputs (one instance per input).
object build_dyn(object input_shape)
Creates the variables of the layer (optional, for subclass implementers). This is a method that implementers of subclasses of `Layer` or `Model`
can override if they need a state-creation step in-between
layer instantiation and layer call. This is typically used to create the weights of `Layer` subclasses.
Parameters
-
objectinput_shape - Instance of `TensorShape`, or list of instances of `TensorShape` if the layer expects a list of inputs (one instance per input).
Tensor call(IEnumerable<IGraphNodeBase> inputs, IGraphNodeBase training, IEnumerable<IGraphNodeBase> mask)
Tensor call(IEnumerable<IGraphNodeBase> inputs, bool training, IGraphNodeBase mask)
Tensor call(IEnumerable<IGraphNodeBase> inputs, bool training, IEnumerable<IGraphNodeBase> mask)
Tensor call(IEnumerable<IGraphNodeBase> inputs, IGraphNodeBase training, IGraphNodeBase mask)
Tensor call(IGraphNodeBase inputs, bool training, IEnumerable<IGraphNodeBase> mask)
Tensor call(IGraphNodeBase inputs, bool training, IGraphNodeBase mask)
Tensor call(IGraphNodeBase inputs, IGraphNodeBase training, IEnumerable<IGraphNodeBase> mask)
Tensor call(IGraphNodeBase inputs, IGraphNodeBase training, IGraphNodeBase mask)
Tensor call(IEnumerable<IGraphNodeBase> input_window_features, IEnumerable<IGraphNodeBase> output_window_features)
Tensor call(string input_window_features, PythonClassContainer output_window_features)
Tensor call(string input_window_features, object output_window_features)
Tensor call(string input_window_features, IEnumerable<IGraphNodeBase> output_window_features)
Tensor call(PythonClassContainer input_window_features, object output_window_features)
Tensor call(PythonClassContainer input_window_features, PythonClassContainer output_window_features)
Tensor call(PythonClassContainer input_window_features, IEnumerable<IGraphNodeBase> output_window_features)
Tensor call(IGraphNodeBase input_window_features, object output_window_features)
Tensor call(IGraphNodeBase input_window_features, PythonClassContainer output_window_features)
Tensor call(IGraphNodeBase input_window_features, IEnumerable<IGraphNodeBase> output_window_features)
Tensor call(IndexedSlices input_window_features, object output_window_features)
Tensor call(IndexedSlices input_window_features, IEnumerable<IGraphNodeBase> output_window_features)
Tensor call(IEnumerable<IGraphNodeBase> input_window_features, object output_window_features)
Tensor call(IEnumerable<IGraphNodeBase> input_window_features, PythonClassContainer output_window_features)
Tensor call(IndexedSlices input_window_features, PythonClassContainer output_window_features)
object call_dyn(object input_window_features, object output_window_features)
Invokes the `Loss` instance.
void compile(ImplicitContainer<T> optimizer, PythonFunctionContainer loss, IDictionary<string, string> metrics, IEnumerable<double> loss_weights, string sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
PythonFunctionContainerloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IDictionary<string, string>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IEnumerable<double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
stringsample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, object loss, IDictionary<string, string> metrics, IEnumerable<double> loss_weights, string sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
objectloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IDictionary<string, string>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IEnumerable<double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
stringsample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, object loss, IDictionary<string, string> metrics, IEnumerable<double> loss_weights, IEnumerable<object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
objectloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IDictionary<string, string>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IEnumerable<double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IEnumerable<object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, object loss, IDictionary<string, string> metrics, IEnumerable<double> loss_weights, IDictionary<string, object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
objectloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IDictionary<string, string>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IEnumerable<double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IDictionary<string, object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, object loss, IDictionary<string, string> metrics, IDictionary<string, double> loss_weights, string sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
objectloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IDictionary<string, string>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IDictionary<string, double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
stringsample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, object loss, IEnumerable<object> metrics, IDictionary<string, double> loss_weights, string sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
objectloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IEnumerable<object>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IDictionary<string, double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
stringsample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, object loss, IDictionary<string, string> metrics, IDictionary<string, double> loss_weights, IDictionary<string, object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
objectloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IDictionary<string, string>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IDictionary<string, double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IDictionary<string, object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, PythonFunctionContainer loss, CategoricalAccuracy metrics, IEnumerable<double> loss_weights, string sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
PythonFunctionContainerloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
CategoricalAccuracymetrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IEnumerable<double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
stringsample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, object loss, IDictionary<string, string> metrics, IDictionary<string, double> loss_weights, IEnumerable<object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
objectloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IDictionary<string, string>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IDictionary<string, double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IEnumerable<object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, object loss, IEnumerable<object> metrics, IDictionary<string, double> loss_weights, IDictionary<string, object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
objectloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IEnumerable<object>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IDictionary<string, double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IDictionary<string, object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, PythonFunctionContainer loss, CategoricalAccuracy metrics, IEnumerable<double> loss_weights, IDictionary<string, object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
PythonFunctionContainerloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
CategoricalAccuracymetrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IEnumerable<double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IDictionary<string, object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, PythonFunctionContainer loss, CategoricalAccuracy metrics, IDictionary<string, double> loss_weights, string sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
PythonFunctionContainerloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
CategoricalAccuracymetrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IDictionary<string, double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
stringsample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, object loss, IEnumerable<object> metrics, IDictionary<string, double> loss_weights, IEnumerable<object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
objectloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IEnumerable<object>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IDictionary<string, double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IEnumerable<object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, PythonFunctionContainer loss, CategoricalAccuracy metrics, IEnumerable<double> loss_weights, IEnumerable<object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
PythonFunctionContainerloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
CategoricalAccuracymetrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IEnumerable<double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IEnumerable<object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, PythonFunctionContainer loss, CategoricalAccuracy metrics, IDictionary<string, double> loss_weights, IDictionary<string, object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
PythonFunctionContainerloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
CategoricalAccuracymetrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IDictionary<string, double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IDictionary<string, object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, PythonFunctionContainer loss, IDictionary<string, string> metrics, IEnumerable<double> loss_weights, IEnumerable<object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
PythonFunctionContainerloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IDictionary<string, string>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IEnumerable<double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IEnumerable<object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, PythonFunctionContainer loss, CategoricalAccuracy metrics, IDictionary<string, double> loss_weights, IEnumerable<object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
PythonFunctionContainerloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
CategoricalAccuracymetrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IDictionary<string, double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IEnumerable<object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, PythonFunctionContainer loss, IDictionary<string, string> metrics, IDictionary<string, double> loss_weights, string sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
PythonFunctionContainerloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IDictionary<string, string>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IDictionary<string, double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
stringsample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, PythonFunctionContainer loss, IDictionary<string, string> metrics, IDictionary<string, double> loss_weights, IEnumerable<object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
PythonFunctionContainerloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IDictionary<string, string>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IDictionary<string, double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IEnumerable<object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, PythonFunctionContainer loss, IEnumerable<object> metrics, IEnumerable<double> loss_weights, IEnumerable<object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
PythonFunctionContainerloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IEnumerable<object>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IEnumerable<double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IEnumerable<object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, PythonFunctionContainer loss, IDictionary<string, string> metrics, IEnumerable<double> loss_weights, IDictionary<string, object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
PythonFunctionContainerloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IDictionary<string, string>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IEnumerable<double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IDictionary<string, object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, PythonFunctionContainer loss, IEnumerable<object> metrics, IEnumerable<double> loss_weights, string sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
PythonFunctionContainerloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IEnumerable<object>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IEnumerable<double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
stringsample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
void compile(ImplicitContainer<T> optimizer, PythonFunctionContainer loss, IDictionary<string, string> metrics, IDictionary<string, double> loss_weights, IDictionary<string, object> sample_weight_mode, object weighted_metrics, object target_tensors, object distribute, IDictionary<string, object> kwargs)
Configures the model for training.
Parameters
-
ImplicitContainer<T>optimizer - String (name of optimizer) or optimizer instance.
See
tf.keras.optimizers. -
PythonFunctionContainerloss - String (name of objective function), objective function or
`tf.losses.Loss` instance. See
tf.losses. If the model has multiple outputs, you can use a different loss on each output by passing a dictionary or a list of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. -
IDictionary<string, string>metrics - List of metrics to be evaluated by the model during training and testing. Typically you will use `metrics=['accuracy']`. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. You can also pass a list (len = len(outputs)) of lists of metrics such as `metrics=[['accuracy'], ['accuracy', 'mse']]` or `metrics=['accuracy', ['accuracy', 'mse']]`.
-
IDictionary<string, double>loss_weights - Optional list or dictionary specifying scalar coefficients (Python floats) to weight the loss contributions of different model outputs. The loss value that will be minimized by the model will then be the *weighted sum* of all individual losses, weighted by the `loss_weights` coefficients. If a list, it is expected to have a 1:1 mapping to the model's outputs. If a tensor, it is expected to map output names (strings) to scalar coefficients.
-
IDictionary<string, object>sample_weight_mode - If you need to do timestep-wise sample weighting (2D weights), set this to `"temporal"`. `None` defaults to sample-wise weights (1D). If the model has multiple outputs, you can use a different `sample_weight_mode` on each output by passing a dictionary or a list of modes.
-
objectweighted_metrics - List of metrics to be evaluated and weighted by sample_weight or class_weight during training and testing.
-
objecttarget_tensors - By default, Keras will create placeholders for the model's target, which will be fed with the target data during training. If instead you would like to use your own target tensors (in turn, Keras will not expect external Numpy data for these targets at training time), you can specify them via the `target_tensors` argument. It can be a single tensor (for a single-output model), a list of tensors, or a dict mapping output names to target tensors.
-
objectdistribute - NOT SUPPORTED IN TF 2.0, please create and compile the model under distribution strategy scope instead of passing it to compile.
-
IDictionary<string, object>kwargs - Any additional arguments.
object compute_mask(IGraphNodeBase inputs, IGraphNodeBase mask)
Computes an output mask tensor.
Parameters
-
IGraphNodeBaseinputs - Tensor or list of tensors.
-
IGraphNodeBasemask - Tensor or list of tensors.
Returns
-
object - None or a tensor (or list of tensors, one per output tensor of the layer).
object compute_mask(IGraphNodeBase inputs, IEnumerable<object> mask)
Computes an output mask tensor.
Parameters
-
IGraphNodeBaseinputs - Tensor or list of tensors.
-
IEnumerable<object>mask - Tensor or list of tensors.
Returns
-
object - None or a tensor (or list of tensors, one per output tensor of the layer).
object compute_mask(IEnumerable<IGraphNodeBase> inputs, IGraphNodeBase mask)
Computes an output mask tensor.
Parameters
-
IEnumerable<IGraphNodeBase>inputs - Tensor or list of tensors.
-
IGraphNodeBasemask - Tensor or list of tensors.
Returns
-
object - None or a tensor (or list of tensors, one per output tensor of the layer).
object compute_mask(IEnumerable<IGraphNodeBase> inputs, IEnumerable<object> mask)
Computes an output mask tensor.
Parameters
-
IEnumerable<IGraphNodeBase>inputs - Tensor or list of tensors.
-
IEnumerable<object>mask - Tensor or list of tensors.
Returns
-
object - None or a tensor (or list of tensors, one per output tensor of the layer).
object compute_mask_dyn(object inputs, object mask)
Computes an output mask tensor.
Parameters
-
objectinputs - Tensor or list of tensors.
-
objectmask - Tensor or list of tensors.
Returns
-
object - None or a tensor (or list of tensors, one per output tensor of the layer).
TensorShape compute_output_shape(TensorShape input_shape)
Computes the output shape of the layer. If the layer has not been built, this method will call `build` on the
layer. This assumes that the layer will later be used with inputs that
match the input shape provided here.
Parameters
-
TensorShapeinput_shape - Shape tuple (tuple of integers) or list of shape tuples (one per output tensor of the layer). Shape tuples can include None for free dimensions, instead of an integer.
Returns
-
TensorShape - An input shape tuple.
object compute_output_shape_dyn(object input_shape)
Computes the output shape of the layer. If the layer has not been built, this method will call `build` on the
layer. This assumes that the layer will later be used with inputs that
match the input shape provided here.
Parameters
-
objectinput_shape - Shape tuple (tuple of integers) or list of shape tuples (one per output tensor of the layer). Shape tuples can include None for free dimensions, instead of an integer.
Returns
-
object - An input shape tuple.
object compute_output_signature(TensorSpec input_signature)
Compute the output tensor signature of the layer based on the inputs. Unlike a TensorShape object, a TensorSpec object contains both shape
and dtype information for a tensor. This method allows layers to provide
output dtype information if it is different from the input dtype.
For any layer that doesn't implement this function,
the framework will fall back to use `compute_output_shape`, and will
assume that the output dtype matches the input dtype.
Parameters
-
TensorSpecinput_signature - Single TensorSpec or nested structure of TensorSpec objects, describing a candidate input for the layer.
Returns
-
object - Single TensorSpec or nested structure of TensorSpec objects, describing how the layer would transform the provided input.
object compute_output_signature(IEnumerable<TensorSpec> input_signature)
Compute the output tensor signature of the layer based on the inputs. Unlike a TensorShape object, a TensorSpec object contains both shape
and dtype information for a tensor. This method allows layers to provide
output dtype information if it is different from the input dtype.
For any layer that doesn't implement this function,
the framework will fall back to use `compute_output_shape`, and will
assume that the output dtype matches the input dtype.
Parameters
-
IEnumerable<TensorSpec>input_signature - Single TensorSpec or nested structure of TensorSpec objects, describing a candidate input for the layer.
Returns
-
object - Single TensorSpec or nested structure of TensorSpec objects, describing how the layer would transform the provided input.
object compute_output_signature_dyn(object input_signature)
Compute the output tensor signature of the layer based on the inputs. Unlike a TensorShape object, a TensorSpec object contains both shape
and dtype information for a tensor. This method allows layers to provide
output dtype information if it is different from the input dtype.
For any layer that doesn't implement this function,
the framework will fall back to use `compute_output_shape`, and will
assume that the output dtype matches the input dtype.
Parameters
-
objectinput_signature - Single TensorSpec or nested structure of TensorSpec objects, describing a candidate input for the layer.
Returns
-
object - Single TensorSpec or nested structure of TensorSpec objects, describing how the layer would transform the provided input.
int count_params()
Count the total number of scalars composing the weights.
Returns
-
int - An integer count.
object count_params_dyn()
Count the total number of scalars composing the weights.
Returns
-
object - An integer count.
object evaluate(object x, IGraphNodeBase y, Nullable<int> batch_size, int verbose, IDictionary<string, object> sample_weight, Nullable<int> steps, IEnumerable<Callback> callbacks, int max_queue_size, int workers, bool use_multiprocessing)
Returns the loss value & metrics values for the model in test mode. Computation is done in batches.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
IGraphNodeBasey - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from the iterator/dataset).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intverbose - 0 or 1. Verbosity mode. 0 = silent, 1 = progress bar.
-
IDictionary<string, object>sample_weight - Optional Numpy array of weights for the test samples, used for weighting the loss function. You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, instead pass sample weights as the third element of `x`.
-
Nullable<int>steps - Integer or `None`.
Total number of steps (batches of samples)
before declaring the evaluation round finished.
Ignored with the default value of `None`.
If x is a
tf.datadataset and `steps` is None, 'evaluate' will run until the dataset is exhausted. This argument is not supported with array inputs. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during evaluation. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object evaluate(object x, IGraphNodeBase y, Nullable<int> batch_size, int verbose, IEnumerable<object> sample_weight, Nullable<int> steps, IEnumerable<Callback> callbacks, int max_queue_size, int workers, bool use_multiprocessing)
Returns the loss value & metrics values for the model in test mode. Computation is done in batches.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
IGraphNodeBasey - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from the iterator/dataset).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intverbose - 0 or 1. Verbosity mode. 0 = silent, 1 = progress bar.
-
IEnumerable<object>sample_weight - Optional Numpy array of weights for the test samples, used for weighting the loss function. You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, instead pass sample weights as the third element of `x`.
-
Nullable<int>steps - Integer or `None`.
Total number of steps (batches of samples)
before declaring the evaluation round finished.
Ignored with the default value of `None`.
If x is a
tf.datadataset and `steps` is None, 'evaluate' will run until the dataset is exhausted. This argument is not supported with array inputs. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during evaluation. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object evaluate(object x, IDictionary<string, object> y, Nullable<int> batch_size, int verbose, IEnumerable<object> sample_weight, Nullable<int> steps, IEnumerable<Callback> callbacks, int max_queue_size, int workers, bool use_multiprocessing)
Returns the loss value & metrics values for the model in test mode. Computation is done in batches.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
IDictionary<string, object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from the iterator/dataset).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intverbose - 0 or 1. Verbosity mode. 0 = silent, 1 = progress bar.
-
IEnumerable<object>sample_weight - Optional Numpy array of weights for the test samples, used for weighting the loss function. You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, instead pass sample weights as the third element of `x`.
-
Nullable<int>steps - Integer or `None`.
Total number of steps (batches of samples)
before declaring the evaluation round finished.
Ignored with the default value of `None`.
If x is a
tf.datadataset and `steps` is None, 'evaluate' will run until the dataset is exhausted. This argument is not supported with array inputs. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during evaluation. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object evaluate(object x, IEnumerable<object> y, Nullable<int> batch_size, int verbose, ndarray sample_weight, Nullable<int> steps, IEnumerable<Callback> callbacks, int max_queue_size, int workers, bool use_multiprocessing)
Returns the loss value & metrics values for the model in test mode. Computation is done in batches.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
IEnumerable<object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from the iterator/dataset).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intverbose - 0 or 1. Verbosity mode. 0 = silent, 1 = progress bar.
-
ndarraysample_weight - Optional Numpy array of weights for the test samples, used for weighting the loss function. You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, instead pass sample weights as the third element of `x`.
-
Nullable<int>steps - Integer or `None`.
Total number of steps (batches of samples)
before declaring the evaluation round finished.
Ignored with the default value of `None`.
If x is a
tf.datadataset and `steps` is None, 'evaluate' will run until the dataset is exhausted. This argument is not supported with array inputs. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during evaluation. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object evaluate(object x, IDictionary<string, object> y, Nullable<int> batch_size, int verbose, IDictionary<string, object> sample_weight, Nullable<int> steps, IEnumerable<Callback> callbacks, int max_queue_size, int workers, bool use_multiprocessing)
Returns the loss value & metrics values for the model in test mode. Computation is done in batches.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
IDictionary<string, object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from the iterator/dataset).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intverbose - 0 or 1. Verbosity mode. 0 = silent, 1 = progress bar.
-
IDictionary<string, object>sample_weight - Optional Numpy array of weights for the test samples, used for weighting the loss function. You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, instead pass sample weights as the third element of `x`.
-
Nullable<int>steps - Integer or `None`.
Total number of steps (batches of samples)
before declaring the evaluation round finished.
Ignored with the default value of `None`.
If x is a
tf.datadataset and `steps` is None, 'evaluate' will run until the dataset is exhausted. This argument is not supported with array inputs. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during evaluation. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object evaluate(object x, IEnumerable<object> y, Nullable<int> batch_size, int verbose, IDictionary<string, object> sample_weight, Nullable<int> steps, IEnumerable<Callback> callbacks, int max_queue_size, int workers, bool use_multiprocessing)
Returns the loss value & metrics values for the model in test mode. Computation is done in batches.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
IEnumerable<object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from the iterator/dataset).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intverbose - 0 or 1. Verbosity mode. 0 = silent, 1 = progress bar.
-
IDictionary<string, object>sample_weight - Optional Numpy array of weights for the test samples, used for weighting the loss function. You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, instead pass sample weights as the third element of `x`.
-
Nullable<int>steps - Integer or `None`.
Total number of steps (batches of samples)
before declaring the evaluation round finished.
Ignored with the default value of `None`.
If x is a
tf.datadataset and `steps` is None, 'evaluate' will run until the dataset is exhausted. This argument is not supported with array inputs. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during evaluation. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object evaluate(object x, IEnumerable<object> y, Nullable<int> batch_size, bool verbose, IEnumerable<object> sample_weight, Nullable<int> steps, IEnumerable<Callback> callbacks, int max_queue_size, int workers, bool use_multiprocessing)
Returns the loss value & metrics values for the model in test mode. Computation is done in batches.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
IEnumerable<object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from the iterator/dataset).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
boolverbose - 0 or 1. Verbosity mode. 0 = silent, 1 = progress bar.
-
IEnumerable<object>sample_weight - Optional Numpy array of weights for the test samples, used for weighting the loss function. You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, instead pass sample weights as the third element of `x`.
-
Nullable<int>steps - Integer or `None`.
Total number of steps (batches of samples)
before declaring the evaluation round finished.
Ignored with the default value of `None`.
If x is a
tf.datadataset and `steps` is None, 'evaluate' will run until the dataset is exhausted. This argument is not supported with array inputs. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during evaluation. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object evaluate(object x, IEnumerable<object> y, Nullable<int> batch_size, bool verbose, IDictionary<string, object> sample_weight, Nullable<int> steps, IEnumerable<Callback> callbacks, int max_queue_size, int workers, bool use_multiprocessing)
Returns the loss value & metrics values for the model in test mode. Computation is done in batches.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
IEnumerable<object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from the iterator/dataset).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
boolverbose - 0 or 1. Verbosity mode. 0 = silent, 1 = progress bar.
-
IDictionary<string, object>sample_weight - Optional Numpy array of weights for the test samples, used for weighting the loss function. You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, instead pass sample weights as the third element of `x`.
-
Nullable<int>steps - Integer or `None`.
Total number of steps (batches of samples)
before declaring the evaluation round finished.
Ignored with the default value of `None`.
If x is a
tf.datadataset and `steps` is None, 'evaluate' will run until the dataset is exhausted. This argument is not supported with array inputs. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during evaluation. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object evaluate(object x, IDictionary<string, object> y, Nullable<int> batch_size, int verbose, ndarray sample_weight, Nullable<int> steps, IEnumerable<Callback> callbacks, int max_queue_size, int workers, bool use_multiprocessing)
Returns the loss value & metrics values for the model in test mode. Computation is done in batches.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
IDictionary<string, object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from the iterator/dataset).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intverbose - 0 or 1. Verbosity mode. 0 = silent, 1 = progress bar.
-
ndarraysample_weight - Optional Numpy array of weights for the test samples, used for weighting the loss function. You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, instead pass sample weights as the third element of `x`.
-
Nullable<int>steps - Integer or `None`.
Total number of steps (batches of samples)
before declaring the evaluation round finished.
Ignored with the default value of `None`.
If x is a
tf.datadataset and `steps` is None, 'evaluate' will run until the dataset is exhausted. This argument is not supported with array inputs. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during evaluation. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object evaluate(object x, IEnumerable<object> y, Nullable<int> batch_size, bool verbose, ndarray sample_weight, Nullable<int> steps, IEnumerable<Callback> callbacks, int max_queue_size, int workers, bool use_multiprocessing)
Returns the loss value & metrics values for the model in test mode. Computation is done in batches.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
IEnumerable<object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from the iterator/dataset).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
boolverbose - 0 or 1. Verbosity mode. 0 = silent, 1 = progress bar.
-
ndarraysample_weight - Optional Numpy array of weights for the test samples, used for weighting the loss function. You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, instead pass sample weights as the third element of `x`.
-
Nullable<int>steps - Integer or `None`.
Total number of steps (batches of samples)
before declaring the evaluation round finished.
Ignored with the default value of `None`.
If x is a
tf.datadataset and `steps` is None, 'evaluate' will run until the dataset is exhausted. This argument is not supported with array inputs. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during evaluation. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object evaluate_dyn(object x, object y, object batch_size, ImplicitContainer<T> verbose, object sample_weight, object steps, object callbacks, ImplicitContainer<T> max_queue_size, ImplicitContainer<T> workers, ImplicitContainer<T> use_multiprocessing)
Returns the loss value & metrics values for the model in test mode. Computation is done in batches.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from the iterator/dataset).
-
objectbatch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
ImplicitContainer<T>verbose - 0 or 1. Verbosity mode. 0 = silent, 1 = progress bar.
-
objectsample_weight - Optional Numpy array of weights for the test samples, used for weighting the loss function. You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, instead pass sample weights as the third element of `x`.
-
objectsteps - Integer or `None`.
Total number of steps (batches of samples)
before declaring the evaluation round finished.
Ignored with the default value of `None`.
If x is a
tf.datadataset and `steps` is None, 'evaluate' will run until the dataset is exhausted. This argument is not supported with array inputs. -
objectcallbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during evaluation. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
ImplicitContainer<T>max_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
ImplicitContainer<T>workers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
ImplicitContainer<T>use_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object evaluate_generator(IEnumerator<ValueTuple<object, object>> generator, Nullable<int> steps, object callbacks, int max_queue_size, int workers, bool use_multiprocessing, int verbose)
Evaluates the model on a data generator. The generator should return the same kind of data
as accepted by `test_on_batch`.
Parameters
-
IEnumerator<ValueTuple<object, object>>generator - Generator yielding tuples (inputs, targets) or (inputs, targets, sample_weights) or an instance of `keras.utils.Sequence` object in order to avoid duplicate data when using multiprocessing.
-
Nullable<int>steps - Total number of steps (batches of samples) to yield from `generator` before stopping. Optional for `Sequence`: if unspecified, will use the `len(generator)` as a number of steps.
-
objectcallbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during evaluation. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - maximum size for the generator queue
-
intworkers - Integer. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
intverbose - Verbosity mode, 0 or 1.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object evaluate_generator_dyn(object generator, object steps, object callbacks, ImplicitContainer<T> max_queue_size, ImplicitContainer<T> workers, ImplicitContainer<T> use_multiprocessing, ImplicitContainer<T> verbose)
Evaluates the model on a data generator. The generator should return the same kind of data
as accepted by `test_on_batch`.
Parameters
-
objectgenerator - Generator yielding tuples (inputs, targets) or (inputs, targets, sample_weights) or an instance of `keras.utils.Sequence` object in order to avoid duplicate data when using multiprocessing.
-
objectsteps - Total number of steps (batches of samples) to yield from `generator` before stopping. Optional for `Sequence`: if unspecified, will use the `len(generator)` as a number of steps.
-
objectcallbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during evaluation. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
ImplicitContainer<T>max_queue_size - maximum size for the generator queue
-
ImplicitContainer<T>workers - Integer. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
ImplicitContainer<T>use_multiprocessing - Boolean. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
ImplicitContainer<T>verbose - Verbosity mode, 0 or 1.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object fit(object x, object y, Nullable<int> batch_size, int epochs, bool verbose, IEnumerable<Callback> callbacks, double validation_split, Dataset validation_data, string shuffle, IDictionary<string, string> class_weight, IDictionary<string, object> sample_weight, int initial_epoch, Nullable<int> steps_per_epoch, Nullable<int> validation_steps, int validation_freq, int max_queue_size, int workers, bool use_multiprocessing, IDictionary<string, object> kwargs)
Trains the model for a fixed number of epochs (iterations on a dataset).
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. Should return a tuple of either `(inputs, targets)` or `(inputs, targets, sample_weights)`. - A generator or `keras.utils.Sequence` returning `(inputs, targets)` or `(inputs, targets, sample weights)`. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator, or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from `x`).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` if your data is in the form of symbolic tensors, datasets, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intepochs - Integer. Number of epochs to train the model. An epoch is an iteration over the entire `x` and `y` data provided. Note that in conjunction with `initial_epoch`, `epochs` is to be understood as "final epoch". The model is not trained for a number of iterations given by `epochs`, but merely until the epoch of index `epochs` is reached.
-
boolverbose - 0, 1, or 2. Verbosity mode. 0 = silent, 1 = progress bar, 2 = one line per epoch. Note that the progress bar is not particularly useful when logged to a file, so verbose=2 is recommended when not running interactively (eg, in a production environment).
-
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances.
List of callbacks to apply during training.
See
tf.keras.callbacks. -
doublevalidation_split - Float between 0 and 1. Fraction of the training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch. The validation data is selected from the last samples in the `x` and `y` data provided, before shuffling. This argument is not supported when `x` is a dataset, generator or `keras.utils.Sequence` instance.
-
Datasetvalidation_data - Data on which to evaluate the loss and any model metrics at the end of each epoch. The model will not be trained on this data. `validation_data` will override `validation_split`. `validation_data` could be: - tuple `(x_val, y_val)` of Numpy arrays or tensors - tuple `(x_val, y_val, val_sample_weights)` of Numpy arrays - dataset For the first two cases, `batch_size` must be provided. For the last case, `validation_steps` must be provided.
-
stringshuffle - Boolean (whether to shuffle the training data before each epoch) or str (for 'batch'). 'batch' is a special option for dealing with the limitations of HDF5 data; it shuffles in batch-sized chunks. Has no effect when `steps_per_epoch` is not `None`.
-
IDictionary<string, string>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) value, used for weighting the loss function (during training only). This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
IDictionary<string, object>sample_weight - Optional Numpy array of weights for the training samples, used for weighting the loss function (during training only). You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, generator, or `keras.utils.Sequence` instance, instead provide the sample_weights as the third element of `x`.
-
intinitial_epoch - Integer. Epoch at which to start training (useful for resuming a previous training run).
-
Nullable<int>steps_per_epoch - Integer or `None`.
Total number of steps (batches of samples)
before declaring one epoch finished and starting the
next epoch. When training with input tensors such as
TensorFlow data tensors, the default `None` is equal to
the number of samples in your dataset divided by
the batch size, or 1 if that cannot be determined. If x is a
tf.datadataset, and 'steps_per_epoch' is None, the epoch will run until the input dataset is exhausted. This argument is not supported with array inputs. -
Nullable<int>validation_steps - Only relevant if `validation_data` is provided and
is a
tf.datadataset. Total number of steps (batches of samples) to draw before stopping when performing validation at the end of every epoch. If validation_data is atf.datadataset and 'validation_steps' is None, validation will run until the `validation_data` dataset is exhausted. -
intvalidation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
IDictionary<string, object>kwargs - Used for backwards compatibility.
Returns
-
object - A `History` object. Its `History.history` attribute is a record of training loss values and metrics values at successive epochs, as well as validation loss values and validation metrics values (if applicable).
object fit(object x, object y, Nullable<int> batch_size, int epochs, bool verbose, IEnumerable<Callback> callbacks, double validation_split, Dataset validation_data, bool shuffle, IDictionary<string, string> class_weight, IDictionary<string, object> sample_weight, int initial_epoch, Nullable<int> steps_per_epoch, Nullable<int> validation_steps, int validation_freq, int max_queue_size, int workers, bool use_multiprocessing, IDictionary<string, object> kwargs)
Trains the model for a fixed number of epochs (iterations on a dataset).
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. Should return a tuple of either `(inputs, targets)` or `(inputs, targets, sample_weights)`. - A generator or `keras.utils.Sequence` returning `(inputs, targets)` or `(inputs, targets, sample weights)`. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator, or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from `x`).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` if your data is in the form of symbolic tensors, datasets, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intepochs - Integer. Number of epochs to train the model. An epoch is an iteration over the entire `x` and `y` data provided. Note that in conjunction with `initial_epoch`, `epochs` is to be understood as "final epoch". The model is not trained for a number of iterations given by `epochs`, but merely until the epoch of index `epochs` is reached.
-
boolverbose - 0, 1, or 2. Verbosity mode. 0 = silent, 1 = progress bar, 2 = one line per epoch. Note that the progress bar is not particularly useful when logged to a file, so verbose=2 is recommended when not running interactively (eg, in a production environment).
-
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances.
List of callbacks to apply during training.
See
tf.keras.callbacks. -
doublevalidation_split - Float between 0 and 1. Fraction of the training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch. The validation data is selected from the last samples in the `x` and `y` data provided, before shuffling. This argument is not supported when `x` is a dataset, generator or `keras.utils.Sequence` instance.
-
Datasetvalidation_data - Data on which to evaluate the loss and any model metrics at the end of each epoch. The model will not be trained on this data. `validation_data` will override `validation_split`. `validation_data` could be: - tuple `(x_val, y_val)` of Numpy arrays or tensors - tuple `(x_val, y_val, val_sample_weights)` of Numpy arrays - dataset For the first two cases, `batch_size` must be provided. For the last case, `validation_steps` must be provided.
-
boolshuffle - Boolean (whether to shuffle the training data before each epoch) or str (for 'batch'). 'batch' is a special option for dealing with the limitations of HDF5 data; it shuffles in batch-sized chunks. Has no effect when `steps_per_epoch` is not `None`.
-
IDictionary<string, string>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) value, used for weighting the loss function (during training only). This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
IDictionary<string, object>sample_weight - Optional Numpy array of weights for the training samples, used for weighting the loss function (during training only). You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, generator, or `keras.utils.Sequence` instance, instead provide the sample_weights as the third element of `x`.
-
intinitial_epoch - Integer. Epoch at which to start training (useful for resuming a previous training run).
-
Nullable<int>steps_per_epoch - Integer or `None`.
Total number of steps (batches of samples)
before declaring one epoch finished and starting the
next epoch. When training with input tensors such as
TensorFlow data tensors, the default `None` is equal to
the number of samples in your dataset divided by
the batch size, or 1 if that cannot be determined. If x is a
tf.datadataset, and 'steps_per_epoch' is None, the epoch will run until the input dataset is exhausted. This argument is not supported with array inputs. -
Nullable<int>validation_steps - Only relevant if `validation_data` is provided and
is a
tf.datadataset. Total number of steps (batches of samples) to draw before stopping when performing validation at the end of every epoch. If validation_data is atf.datadataset and 'validation_steps' is None, validation will run until the `validation_data` dataset is exhausted. -
intvalidation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
IDictionary<string, object>kwargs - Used for backwards compatibility.
Returns
-
object - A `History` object. Its `History.history` attribute is a record of training loss values and metrics values at successive epochs, as well as validation loss values and validation metrics values (if applicable).
object fit(object x, object y, Nullable<int> batch_size, int epochs, int verbose, IEnumerable<Callback> callbacks, double validation_split, ValueTuple<IEnumerable<object>, object> validation_data, bool shuffle, IDictionary<string, string> class_weight, IEnumerable<object> sample_weight, int initial_epoch, Nullable<int> steps_per_epoch, Nullable<int> validation_steps, int validation_freq, int max_queue_size, int workers, bool use_multiprocessing, IDictionary<string, object> kwargs)
Trains the model for a fixed number of epochs (iterations on a dataset).
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. Should return a tuple of either `(inputs, targets)` or `(inputs, targets, sample_weights)`. - A generator or `keras.utils.Sequence` returning `(inputs, targets)` or `(inputs, targets, sample weights)`. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator, or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from `x`).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` if your data is in the form of symbolic tensors, datasets, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intepochs - Integer. Number of epochs to train the model. An epoch is an iteration over the entire `x` and `y` data provided. Note that in conjunction with `initial_epoch`, `epochs` is to be understood as "final epoch". The model is not trained for a number of iterations given by `epochs`, but merely until the epoch of index `epochs` is reached.
-
intverbose - 0, 1, or 2. Verbosity mode. 0 = silent, 1 = progress bar, 2 = one line per epoch. Note that the progress bar is not particularly useful when logged to a file, so verbose=2 is recommended when not running interactively (eg, in a production environment).
-
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances.
List of callbacks to apply during training.
See
tf.keras.callbacks. -
doublevalidation_split - Float between 0 and 1. Fraction of the training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch. The validation data is selected from the last samples in the `x` and `y` data provided, before shuffling. This argument is not supported when `x` is a dataset, generator or `keras.utils.Sequence` instance.
-
ValueTuple<IEnumerable<object>, object>validation_data - Data on which to evaluate the loss and any model metrics at the end of each epoch. The model will not be trained on this data. `validation_data` will override `validation_split`. `validation_data` could be: - tuple `(x_val, y_val)` of Numpy arrays or tensors - tuple `(x_val, y_val, val_sample_weights)` of Numpy arrays - dataset For the first two cases, `batch_size` must be provided. For the last case, `validation_steps` must be provided.
-
boolshuffle - Boolean (whether to shuffle the training data before each epoch) or str (for 'batch'). 'batch' is a special option for dealing with the limitations of HDF5 data; it shuffles in batch-sized chunks. Has no effect when `steps_per_epoch` is not `None`.
-
IDictionary<string, string>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) value, used for weighting the loss function (during training only). This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
IEnumerable<object>sample_weight - Optional Numpy array of weights for the training samples, used for weighting the loss function (during training only). You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, generator, or `keras.utils.Sequence` instance, instead provide the sample_weights as the third element of `x`.
-
intinitial_epoch - Integer. Epoch at which to start training (useful for resuming a previous training run).
-
Nullable<int>steps_per_epoch - Integer or `None`.
Total number of steps (batches of samples)
before declaring one epoch finished and starting the
next epoch. When training with input tensors such as
TensorFlow data tensors, the default `None` is equal to
the number of samples in your dataset divided by
the batch size, or 1 if that cannot be determined. If x is a
tf.datadataset, and 'steps_per_epoch' is None, the epoch will run until the input dataset is exhausted. This argument is not supported with array inputs. -
Nullable<int>validation_steps - Only relevant if `validation_data` is provided and
is a
tf.datadataset. Total number of steps (batches of samples) to draw before stopping when performing validation at the end of every epoch. If validation_data is atf.datadataset and 'validation_steps' is None, validation will run until the `validation_data` dataset is exhausted. -
intvalidation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
IDictionary<string, object>kwargs - Used for backwards compatibility.
Returns
-
object - A `History` object. Its `History.history` attribute is a record of training loss values and metrics values at successive epochs, as well as validation loss values and validation metrics values (if applicable).
object fit(object x, object y, Nullable<int> batch_size, int epochs, int verbose, IEnumerable<Callback> callbacks, double validation_split, ValueTuple<IEnumerable<object>, object> validation_data, string shuffle, IDictionary<string, string> class_weight, ndarray sample_weight, int initial_epoch, Nullable<int> steps_per_epoch, Nullable<int> validation_steps, int validation_freq, int max_queue_size, int workers, bool use_multiprocessing, IDictionary<string, object> kwargs)
Trains the model for a fixed number of epochs (iterations on a dataset).
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. Should return a tuple of either `(inputs, targets)` or `(inputs, targets, sample_weights)`. - A generator or `keras.utils.Sequence` returning `(inputs, targets)` or `(inputs, targets, sample weights)`. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator, or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from `x`).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` if your data is in the form of symbolic tensors, datasets, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intepochs - Integer. Number of epochs to train the model. An epoch is an iteration over the entire `x` and `y` data provided. Note that in conjunction with `initial_epoch`, `epochs` is to be understood as "final epoch". The model is not trained for a number of iterations given by `epochs`, but merely until the epoch of index `epochs` is reached.
-
intverbose - 0, 1, or 2. Verbosity mode. 0 = silent, 1 = progress bar, 2 = one line per epoch. Note that the progress bar is not particularly useful when logged to a file, so verbose=2 is recommended when not running interactively (eg, in a production environment).
-
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances.
List of callbacks to apply during training.
See
tf.keras.callbacks. -
doublevalidation_split - Float between 0 and 1. Fraction of the training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch. The validation data is selected from the last samples in the `x` and `y` data provided, before shuffling. This argument is not supported when `x` is a dataset, generator or `keras.utils.Sequence` instance.
-
ValueTuple<IEnumerable<object>, object>validation_data - Data on which to evaluate the loss and any model metrics at the end of each epoch. The model will not be trained on this data. `validation_data` will override `validation_split`. `validation_data` could be: - tuple `(x_val, y_val)` of Numpy arrays or tensors - tuple `(x_val, y_val, val_sample_weights)` of Numpy arrays - dataset For the first two cases, `batch_size` must be provided. For the last case, `validation_steps` must be provided.
-
stringshuffle - Boolean (whether to shuffle the training data before each epoch) or str (for 'batch'). 'batch' is a special option for dealing with the limitations of HDF5 data; it shuffles in batch-sized chunks. Has no effect when `steps_per_epoch` is not `None`.
-
IDictionary<string, string>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) value, used for weighting the loss function (during training only). This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
ndarraysample_weight - Optional Numpy array of weights for the training samples, used for weighting the loss function (during training only). You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, generator, or `keras.utils.Sequence` instance, instead provide the sample_weights as the third element of `x`.
-
intinitial_epoch - Integer. Epoch at which to start training (useful for resuming a previous training run).
-
Nullable<int>steps_per_epoch - Integer or `None`.
Total number of steps (batches of samples)
before declaring one epoch finished and starting the
next epoch. When training with input tensors such as
TensorFlow data tensors, the default `None` is equal to
the number of samples in your dataset divided by
the batch size, or 1 if that cannot be determined. If x is a
tf.datadataset, and 'steps_per_epoch' is None, the epoch will run until the input dataset is exhausted. This argument is not supported with array inputs. -
Nullable<int>validation_steps - Only relevant if `validation_data` is provided and
is a
tf.datadataset. Total number of steps (batches of samples) to draw before stopping when performing validation at the end of every epoch. If validation_data is atf.datadataset and 'validation_steps' is None, validation will run until the `validation_data` dataset is exhausted. -
intvalidation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
IDictionary<string, object>kwargs - Used for backwards compatibility.
Returns
-
object - A `History` object. Its `History.history` attribute is a record of training loss values and metrics values at successive epochs, as well as validation loss values and validation metrics values (if applicable).
object fit(object x, object y, Nullable<int> batch_size, int epochs, bool verbose, IEnumerable<Callback> callbacks, double validation_split, Dataset validation_data, string shuffle, IDictionary<string, string> class_weight, ndarray sample_weight, int initial_epoch, Nullable<int> steps_per_epoch, Nullable<int> validation_steps, int validation_freq, int max_queue_size, int workers, bool use_multiprocessing, IDictionary<string, object> kwargs)
Trains the model for a fixed number of epochs (iterations on a dataset).
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. Should return a tuple of either `(inputs, targets)` or `(inputs, targets, sample_weights)`. - A generator or `keras.utils.Sequence` returning `(inputs, targets)` or `(inputs, targets, sample weights)`. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator, or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from `x`).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` if your data is in the form of symbolic tensors, datasets, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intepochs - Integer. Number of epochs to train the model. An epoch is an iteration over the entire `x` and `y` data provided. Note that in conjunction with `initial_epoch`, `epochs` is to be understood as "final epoch". The model is not trained for a number of iterations given by `epochs`, but merely until the epoch of index `epochs` is reached.
-
boolverbose - 0, 1, or 2. Verbosity mode. 0 = silent, 1 = progress bar, 2 = one line per epoch. Note that the progress bar is not particularly useful when logged to a file, so verbose=2 is recommended when not running interactively (eg, in a production environment).
-
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances.
List of callbacks to apply during training.
See
tf.keras.callbacks. -
doublevalidation_split - Float between 0 and 1. Fraction of the training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch. The validation data is selected from the last samples in the `x` and `y` data provided, before shuffling. This argument is not supported when `x` is a dataset, generator or `keras.utils.Sequence` instance.
-
Datasetvalidation_data - Data on which to evaluate the loss and any model metrics at the end of each epoch. The model will not be trained on this data. `validation_data` will override `validation_split`. `validation_data` could be: - tuple `(x_val, y_val)` of Numpy arrays or tensors - tuple `(x_val, y_val, val_sample_weights)` of Numpy arrays - dataset For the first two cases, `batch_size` must be provided. For the last case, `validation_steps` must be provided.
-
stringshuffle - Boolean (whether to shuffle the training data before each epoch) or str (for 'batch'). 'batch' is a special option for dealing with the limitations of HDF5 data; it shuffles in batch-sized chunks. Has no effect when `steps_per_epoch` is not `None`.
-
IDictionary<string, string>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) value, used for weighting the loss function (during training only). This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
ndarraysample_weight - Optional Numpy array of weights for the training samples, used for weighting the loss function (during training only). You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, generator, or `keras.utils.Sequence` instance, instead provide the sample_weights as the third element of `x`.
-
intinitial_epoch - Integer. Epoch at which to start training (useful for resuming a previous training run).
-
Nullable<int>steps_per_epoch - Integer or `None`.
Total number of steps (batches of samples)
before declaring one epoch finished and starting the
next epoch. When training with input tensors such as
TensorFlow data tensors, the default `None` is equal to
the number of samples in your dataset divided by
the batch size, or 1 if that cannot be determined. If x is a
tf.datadataset, and 'steps_per_epoch' is None, the epoch will run until the input dataset is exhausted. This argument is not supported with array inputs. -
Nullable<int>validation_steps - Only relevant if `validation_data` is provided and
is a
tf.datadataset. Total number of steps (batches of samples) to draw before stopping when performing validation at the end of every epoch. If validation_data is atf.datadataset and 'validation_steps' is None, validation will run until the `validation_data` dataset is exhausted. -
intvalidation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
IDictionary<string, object>kwargs - Used for backwards compatibility.
Returns
-
object - A `History` object. Its `History.history` attribute is a record of training loss values and metrics values at successive epochs, as well as validation loss values and validation metrics values (if applicable).
object fit(IGraphNodeBase input, IGraphNodeBase targetValues, Nullable<int> stepsPerEpoch, int epochs, TrainingVerbosity verbosity, IEnumerable<ICallback> callbacks, IGraphNodeBase validationInput, IGraphNodeBase validationTarget, TrainingShuffleMode shuffleMode, Nullable<int> initialEpoch)
Trains the model for a fixed number of epochs.
Parameters
-
IGraphNodeBaseinput - Input data
-
IGraphNodeBasetargetValues - Target values
-
Nullable<int>stepsPerEpoch - Number of times to loop over input before declaring one epoch finished and starting the next epoch.
-
intepochs - Number of epochs to train the model. An epoch is an iteration over the entire data provided. Note that in conjunction with initialEpoch , epochs is to be understood as "final epoch". The model is not trained for a number of iterations given by epochs , but merely until the epoch of index epochs is reached.
-
TrainingVerbosityverbosity - Specifies verbosity of output. Default is ProgressBar
-
IEnumerable<ICallback>callbacks - Optional list of callbacks to apply during training
-
IGraphNodeBasevalidationInput - Data on which to evaluate the loss and any model metrics at the end of each epoch. The model will not be trained on this data.
-
IGraphNodeBasevalidationTarget - If validationInput is present, specifies the target values for the validation dataset.
-
TrainingShuffleModeshuffleMode - Optional input data shuffling.
-
Nullable<int>initialEpoch - Epoch at which to start training (useful for resuming a previous training run).
Returns
-
object - A `History` object. Its `History.history` attribute is a record of training loss values and metrics values at successive epochs, as well as validation loss values and validation metrics values (if applicable).
object fit(I_ArrayLike input, I_ArrayLike targetValues, Nullable<int> stepsPerEpoch, Nullable<int> validationSteps, int epochs, int batchSize, TrainingVerbosity verbosity, IEnumerable<ICallback> callbacks, I_ArrayLike validationInput, I_ArrayLike validationTarget, TrainingShuffleMode shuffleMode, Nullable<int> initialEpoch)
Trains the model for a fixed number of epochs.
Parameters
-
I_ArrayLikeinput - Input data
-
I_ArrayLiketargetValues - Target values
-
Nullable<int>stepsPerEpoch - Number of batches from input to process in a single epoch. Use
nullto compute that number automatically, to process the entire input once per epoch. -
Nullable<int>validationSteps - Number of batches from validationInput to process in a single epoch.Use
nullto compute that number automatically, to process the entire validationInput once per epoch. -
intepochs - Number of epochs to train the model. An epoch is an iteration over the entire data provided. Note that in conjunction with initialEpoch , epochs is to be understood as "final epoch". The model is not trained for a number of iterations given by epochs , but merely until the epoch of index epochs is reached.
-
intbatchSize - Number of samples per gradient update.
-
TrainingVerbosityverbosity - Specifies verbosity of output. Default is ProgressBar
-
IEnumerable<ICallback>callbacks - Optional list of callbacks to apply during training
-
I_ArrayLikevalidationInput - Data on which to evaluate the loss and any model metrics at the end of each epoch. The model will not be trained on this data.
-
I_ArrayLikevalidationTarget - If validationInput is present, specifies the target values for the validation dataset.
-
TrainingShuffleModeshuffleMode - Optional input data shuffling.
-
Nullable<int>initialEpoch - Epoch at which to start training (useful for resuming a previous training run).
Returns
-
object - A `History` object. Its `History.history` attribute is a record of training loss values and metrics values at successive epochs, as well as validation loss values and validation metrics values (if applicable).
object fit(object x, object y, Nullable<int> batch_size, int epochs, int verbose, IEnumerable<Callback> callbacks, double validation_split, ValueTuple<IEnumerable<object>, object> validation_data, string shuffle, IDictionary<string, string> class_weight, IDictionary<string, object> sample_weight, int initial_epoch, Nullable<int> steps_per_epoch, Nullable<int> validation_steps, int validation_freq, int max_queue_size, int workers, bool use_multiprocessing, IDictionary<string, object> kwargs)
Trains the model for a fixed number of epochs (iterations on a dataset).
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. Should return a tuple of either `(inputs, targets)` or `(inputs, targets, sample_weights)`. - A generator or `keras.utils.Sequence` returning `(inputs, targets)` or `(inputs, targets, sample weights)`. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator, or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from `x`).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` if your data is in the form of symbolic tensors, datasets, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intepochs - Integer. Number of epochs to train the model. An epoch is an iteration over the entire `x` and `y` data provided. Note that in conjunction with `initial_epoch`, `epochs` is to be understood as "final epoch". The model is not trained for a number of iterations given by `epochs`, but merely until the epoch of index `epochs` is reached.
-
intverbose - 0, 1, or 2. Verbosity mode. 0 = silent, 1 = progress bar, 2 = one line per epoch. Note that the progress bar is not particularly useful when logged to a file, so verbose=2 is recommended when not running interactively (eg, in a production environment).
-
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances.
List of callbacks to apply during training.
See
tf.keras.callbacks. -
doublevalidation_split - Float between 0 and 1. Fraction of the training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch. The validation data is selected from the last samples in the `x` and `y` data provided, before shuffling. This argument is not supported when `x` is a dataset, generator or `keras.utils.Sequence` instance.
-
ValueTuple<IEnumerable<object>, object>validation_data - Data on which to evaluate the loss and any model metrics at the end of each epoch. The model will not be trained on this data. `validation_data` will override `validation_split`. `validation_data` could be: - tuple `(x_val, y_val)` of Numpy arrays or tensors - tuple `(x_val, y_val, val_sample_weights)` of Numpy arrays - dataset For the first two cases, `batch_size` must be provided. For the last case, `validation_steps` must be provided.
-
stringshuffle - Boolean (whether to shuffle the training data before each epoch) or str (for 'batch'). 'batch' is a special option for dealing with the limitations of HDF5 data; it shuffles in batch-sized chunks. Has no effect when `steps_per_epoch` is not `None`.
-
IDictionary<string, string>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) value, used for weighting the loss function (during training only). This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
IDictionary<string, object>sample_weight - Optional Numpy array of weights for the training samples, used for weighting the loss function (during training only). You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, generator, or `keras.utils.Sequence` instance, instead provide the sample_weights as the third element of `x`.
-
intinitial_epoch - Integer. Epoch at which to start training (useful for resuming a previous training run).
-
Nullable<int>steps_per_epoch - Integer or `None`.
Total number of steps (batches of samples)
before declaring one epoch finished and starting the
next epoch. When training with input tensors such as
TensorFlow data tensors, the default `None` is equal to
the number of samples in your dataset divided by
the batch size, or 1 if that cannot be determined. If x is a
tf.datadataset, and 'steps_per_epoch' is None, the epoch will run until the input dataset is exhausted. This argument is not supported with array inputs. -
Nullable<int>validation_steps - Only relevant if `validation_data` is provided and
is a
tf.datadataset. Total number of steps (batches of samples) to draw before stopping when performing validation at the end of every epoch. If validation_data is atf.datadataset and 'validation_steps' is None, validation will run until the `validation_data` dataset is exhausted. -
intvalidation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
IDictionary<string, object>kwargs - Used for backwards compatibility.
Returns
-
object - A `History` object. Its `History.history` attribute is a record of training loss values and metrics values at successive epochs, as well as validation loss values and validation metrics values (if applicable).
object fit(object x, object y, Nullable<int> batch_size, int epochs, int verbose, IEnumerable<Callback> callbacks, double validation_split, ValueTuple<IEnumerable<object>, object> validation_data, string shuffle, IDictionary<string, string> class_weight, IEnumerable<object> sample_weight, int initial_epoch, Nullable<int> steps_per_epoch, Nullable<int> validation_steps, int validation_freq, int max_queue_size, int workers, bool use_multiprocessing, IDictionary<string, object> kwargs)
Trains the model for a fixed number of epochs (iterations on a dataset).
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. Should return a tuple of either `(inputs, targets)` or `(inputs, targets, sample_weights)`. - A generator or `keras.utils.Sequence` returning `(inputs, targets)` or `(inputs, targets, sample weights)`. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator, or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from `x`).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` if your data is in the form of symbolic tensors, datasets, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intepochs - Integer. Number of epochs to train the model. An epoch is an iteration over the entire `x` and `y` data provided. Note that in conjunction with `initial_epoch`, `epochs` is to be understood as "final epoch". The model is not trained for a number of iterations given by `epochs`, but merely until the epoch of index `epochs` is reached.
-
intverbose - 0, 1, or 2. Verbosity mode. 0 = silent, 1 = progress bar, 2 = one line per epoch. Note that the progress bar is not particularly useful when logged to a file, so verbose=2 is recommended when not running interactively (eg, in a production environment).
-
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances.
List of callbacks to apply during training.
See
tf.keras.callbacks. -
doublevalidation_split - Float between 0 and 1. Fraction of the training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch. The validation data is selected from the last samples in the `x` and `y` data provided, before shuffling. This argument is not supported when `x` is a dataset, generator or `keras.utils.Sequence` instance.
-
ValueTuple<IEnumerable<object>, object>validation_data - Data on which to evaluate the loss and any model metrics at the end of each epoch. The model will not be trained on this data. `validation_data` will override `validation_split`. `validation_data` could be: - tuple `(x_val, y_val)` of Numpy arrays or tensors - tuple `(x_val, y_val, val_sample_weights)` of Numpy arrays - dataset For the first two cases, `batch_size` must be provided. For the last case, `validation_steps` must be provided.
-
stringshuffle - Boolean (whether to shuffle the training data before each epoch) or str (for 'batch'). 'batch' is a special option for dealing with the limitations of HDF5 data; it shuffles in batch-sized chunks. Has no effect when `steps_per_epoch` is not `None`.
-
IDictionary<string, string>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) value, used for weighting the loss function (during training only). This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
IEnumerable<object>sample_weight - Optional Numpy array of weights for the training samples, used for weighting the loss function (during training only). You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, generator, or `keras.utils.Sequence` instance, instead provide the sample_weights as the third element of `x`.
-
intinitial_epoch - Integer. Epoch at which to start training (useful for resuming a previous training run).
-
Nullable<int>steps_per_epoch - Integer or `None`.
Total number of steps (batches of samples)
before declaring one epoch finished and starting the
next epoch. When training with input tensors such as
TensorFlow data tensors, the default `None` is equal to
the number of samples in your dataset divided by
the batch size, or 1 if that cannot be determined. If x is a
tf.datadataset, and 'steps_per_epoch' is None, the epoch will run until the input dataset is exhausted. This argument is not supported with array inputs. -
Nullable<int>validation_steps - Only relevant if `validation_data` is provided and
is a
tf.datadataset. Total number of steps (batches of samples) to draw before stopping when performing validation at the end of every epoch. If validation_data is atf.datadataset and 'validation_steps' is None, validation will run until the `validation_data` dataset is exhausted. -
intvalidation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
IDictionary<string, object>kwargs - Used for backwards compatibility.
Returns
-
object - A `History` object. Its `History.history` attribute is a record of training loss values and metrics values at successive epochs, as well as validation loss values and validation metrics values (if applicable).
object fit(object x, object y, Nullable<int> batch_size, int epochs, int verbose, IEnumerable<Callback> callbacks, double validation_split, Dataset validation_data, bool shuffle, IDictionary<string, string> class_weight, ndarray sample_weight, int initial_epoch, Nullable<int> steps_per_epoch, Nullable<int> validation_steps, int validation_freq, int max_queue_size, int workers, bool use_multiprocessing, IDictionary<string, object> kwargs)
Trains the model for a fixed number of epochs (iterations on a dataset).
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. Should return a tuple of either `(inputs, targets)` or `(inputs, targets, sample_weights)`. - A generator or `keras.utils.Sequence` returning `(inputs, targets)` or `(inputs, targets, sample weights)`. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator, or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from `x`).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` if your data is in the form of symbolic tensors, datasets, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intepochs - Integer. Number of epochs to train the model. An epoch is an iteration over the entire `x` and `y` data provided. Note that in conjunction with `initial_epoch`, `epochs` is to be understood as "final epoch". The model is not trained for a number of iterations given by `epochs`, but merely until the epoch of index `epochs` is reached.
-
intverbose - 0, 1, or 2. Verbosity mode. 0 = silent, 1 = progress bar, 2 = one line per epoch. Note that the progress bar is not particularly useful when logged to a file, so verbose=2 is recommended when not running interactively (eg, in a production environment).
-
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances.
List of callbacks to apply during training.
See
tf.keras.callbacks. -
doublevalidation_split - Float between 0 and 1. Fraction of the training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch. The validation data is selected from the last samples in the `x` and `y` data provided, before shuffling. This argument is not supported when `x` is a dataset, generator or `keras.utils.Sequence` instance.
-
Datasetvalidation_data - Data on which to evaluate the loss and any model metrics at the end of each epoch. The model will not be trained on this data. `validation_data` will override `validation_split`. `validation_data` could be: - tuple `(x_val, y_val)` of Numpy arrays or tensors - tuple `(x_val, y_val, val_sample_weights)` of Numpy arrays - dataset For the first two cases, `batch_size` must be provided. For the last case, `validation_steps` must be provided.
-
boolshuffle - Boolean (whether to shuffle the training data before each epoch) or str (for 'batch'). 'batch' is a special option for dealing with the limitations of HDF5 data; it shuffles in batch-sized chunks. Has no effect when `steps_per_epoch` is not `None`.
-
IDictionary<string, string>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) value, used for weighting the loss function (during training only). This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
ndarraysample_weight - Optional Numpy array of weights for the training samples, used for weighting the loss function (during training only). You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, generator, or `keras.utils.Sequence` instance, instead provide the sample_weights as the third element of `x`.
-
intinitial_epoch - Integer. Epoch at which to start training (useful for resuming a previous training run).
-
Nullable<int>steps_per_epoch - Integer or `None`.
Total number of steps (batches of samples)
before declaring one epoch finished and starting the
next epoch. When training with input tensors such as
TensorFlow data tensors, the default `None` is equal to
the number of samples in your dataset divided by
the batch size, or 1 if that cannot be determined. If x is a
tf.datadataset, and 'steps_per_epoch' is None, the epoch will run until the input dataset is exhausted. This argument is not supported with array inputs. -
Nullable<int>validation_steps - Only relevant if `validation_data` is provided and
is a
tf.datadataset. Total number of steps (batches of samples) to draw before stopping when performing validation at the end of every epoch. If validation_data is atf.datadataset and 'validation_steps' is None, validation will run until the `validation_data` dataset is exhausted. -
intvalidation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
IDictionary<string, object>kwargs - Used for backwards compatibility.
Returns
-
object - A `History` object. Its `History.history` attribute is a record of training loss values and metrics values at successive epochs, as well as validation loss values and validation metrics values (if applicable).
object fit(object x, object y, Nullable<int> batch_size, int epochs, int verbose, IEnumerable<Callback> callbacks, double validation_split, Dataset validation_data, bool shuffle, IDictionary<string, string> class_weight, IDictionary<string, object> sample_weight, int initial_epoch, Nullable<int> steps_per_epoch, Nullable<int> validation_steps, int validation_freq, int max_queue_size, int workers, bool use_multiprocessing, IDictionary<string, object> kwargs)
Trains the model for a fixed number of epochs (iterations on a dataset).
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. Should return a tuple of either `(inputs, targets)` or `(inputs, targets, sample_weights)`. - A generator or `keras.utils.Sequence` returning `(inputs, targets)` or `(inputs, targets, sample weights)`. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator, or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from `x`).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` if your data is in the form of symbolic tensors, datasets, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intepochs - Integer. Number of epochs to train the model. An epoch is an iteration over the entire `x` and `y` data provided. Note that in conjunction with `initial_epoch`, `epochs` is to be understood as "final epoch". The model is not trained for a number of iterations given by `epochs`, but merely until the epoch of index `epochs` is reached.
-
intverbose - 0, 1, or 2. Verbosity mode. 0 = silent, 1 = progress bar, 2 = one line per epoch. Note that the progress bar is not particularly useful when logged to a file, so verbose=2 is recommended when not running interactively (eg, in a production environment).
-
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances.
List of callbacks to apply during training.
See
tf.keras.callbacks. -
doublevalidation_split - Float between 0 and 1. Fraction of the training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch. The validation data is selected from the last samples in the `x` and `y` data provided, before shuffling. This argument is not supported when `x` is a dataset, generator or `keras.utils.Sequence` instance.
-
Datasetvalidation_data - Data on which to evaluate the loss and any model metrics at the end of each epoch. The model will not be trained on this data. `validation_data` will override `validation_split`. `validation_data` could be: - tuple `(x_val, y_val)` of Numpy arrays or tensors - tuple `(x_val, y_val, val_sample_weights)` of Numpy arrays - dataset For the first two cases, `batch_size` must be provided. For the last case, `validation_steps` must be provided.
-
boolshuffle - Boolean (whether to shuffle the training data before each epoch) or str (for 'batch'). 'batch' is a special option for dealing with the limitations of HDF5 data; it shuffles in batch-sized chunks. Has no effect when `steps_per_epoch` is not `None`.
-
IDictionary<string, string>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) value, used for weighting the loss function (during training only). This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
IDictionary<string, object>sample_weight - Optional Numpy array of weights for the training samples, used for weighting the loss function (during training only). You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, generator, or `keras.utils.Sequence` instance, instead provide the sample_weights as the third element of `x`.
-
intinitial_epoch - Integer. Epoch at which to start training (useful for resuming a previous training run).
-
Nullable<int>steps_per_epoch - Integer or `None`.
Total number of steps (batches of samples)
before declaring one epoch finished and starting the
next epoch. When training with input tensors such as
TensorFlow data tensors, the default `None` is equal to
the number of samples in your dataset divided by
the batch size, or 1 if that cannot be determined. If x is a
tf.datadataset, and 'steps_per_epoch' is None, the epoch will run until the input dataset is exhausted. This argument is not supported with array inputs. -
Nullable<int>validation_steps - Only relevant if `validation_data` is provided and
is a
tf.datadataset. Total number of steps (batches of samples) to draw before stopping when performing validation at the end of every epoch. If validation_data is atf.datadataset and 'validation_steps' is None, validation will run until the `validation_data` dataset is exhausted. -
intvalidation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
IDictionary<string, object>kwargs - Used for backwards compatibility.
Returns
-
object - A `History` object. Its `History.history` attribute is a record of training loss values and metrics values at successive epochs, as well as validation loss values and validation metrics values (if applicable).
object fit(object x, object y, Nullable<int> batch_size, int epochs, int verbose, IEnumerable<Callback> callbacks, double validation_split, Dataset validation_data, bool shuffle, IDictionary<string, string> class_weight, IEnumerable<object> sample_weight, int initial_epoch, Nullable<int> steps_per_epoch, Nullable<int> validation_steps, int validation_freq, int max_queue_size, int workers, bool use_multiprocessing, IDictionary<string, object> kwargs)
Trains the model for a fixed number of epochs (iterations on a dataset).
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. Should return a tuple of either `(inputs, targets)` or `(inputs, targets, sample_weights)`. - A generator or `keras.utils.Sequence` returning `(inputs, targets)` or `(inputs, targets, sample weights)`. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator, or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from `x`).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` if your data is in the form of symbolic tensors, datasets, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intepochs - Integer. Number of epochs to train the model. An epoch is an iteration over the entire `x` and `y` data provided. Note that in conjunction with `initial_epoch`, `epochs` is to be understood as "final epoch". The model is not trained for a number of iterations given by `epochs`, but merely until the epoch of index `epochs` is reached.
-
intverbose - 0, 1, or 2. Verbosity mode. 0 = silent, 1 = progress bar, 2 = one line per epoch. Note that the progress bar is not particularly useful when logged to a file, so verbose=2 is recommended when not running interactively (eg, in a production environment).
-
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances.
List of callbacks to apply during training.
See
tf.keras.callbacks. -
doublevalidation_split - Float between 0 and 1. Fraction of the training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch. The validation data is selected from the last samples in the `x` and `y` data provided, before shuffling. This argument is not supported when `x` is a dataset, generator or `keras.utils.Sequence` instance.
-
Datasetvalidation_data - Data on which to evaluate the loss and any model metrics at the end of each epoch. The model will not be trained on this data. `validation_data` will override `validation_split`. `validation_data` could be: - tuple `(x_val, y_val)` of Numpy arrays or tensors - tuple `(x_val, y_val, val_sample_weights)` of Numpy arrays - dataset For the first two cases, `batch_size` must be provided. For the last case, `validation_steps` must be provided.
-
boolshuffle - Boolean (whether to shuffle the training data before each epoch) or str (for 'batch'). 'batch' is a special option for dealing with the limitations of HDF5 data; it shuffles in batch-sized chunks. Has no effect when `steps_per_epoch` is not `None`.
-
IDictionary<string, string>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) value, used for weighting the loss function (during training only). This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
IEnumerable<object>sample_weight - Optional Numpy array of weights for the training samples, used for weighting the loss function (during training only). You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, generator, or `keras.utils.Sequence` instance, instead provide the sample_weights as the third element of `x`.
-
intinitial_epoch - Integer. Epoch at which to start training (useful for resuming a previous training run).
-
Nullable<int>steps_per_epoch - Integer or `None`.
Total number of steps (batches of samples)
before declaring one epoch finished and starting the
next epoch. When training with input tensors such as
TensorFlow data tensors, the default `None` is equal to
the number of samples in your dataset divided by
the batch size, or 1 if that cannot be determined. If x is a
tf.datadataset, and 'steps_per_epoch' is None, the epoch will run until the input dataset is exhausted. This argument is not supported with array inputs. -
Nullable<int>validation_steps - Only relevant if `validation_data` is provided and
is a
tf.datadataset. Total number of steps (batches of samples) to draw before stopping when performing validation at the end of every epoch. If validation_data is atf.datadataset and 'validation_steps' is None, validation will run until the `validation_data` dataset is exhausted. -
intvalidation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
IDictionary<string, object>kwargs - Used for backwards compatibility.
Returns
-
object - A `History` object. Its `History.history` attribute is a record of training loss values and metrics values at successive epochs, as well as validation loss values and validation metrics values (if applicable).
object fit(object x, object y, Nullable<int> batch_size, int epochs, int verbose, IEnumerable<Callback> callbacks, double validation_split, Dataset validation_data, string shuffle, IDictionary<string, string> class_weight, ndarray sample_weight, int initial_epoch, Nullable<int> steps_per_epoch, Nullable<int> validation_steps, int validation_freq, int max_queue_size, int workers, bool use_multiprocessing, IDictionary<string, object> kwargs)
Trains the model for a fixed number of epochs (iterations on a dataset).
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. Should return a tuple of either `(inputs, targets)` or `(inputs, targets, sample_weights)`. - A generator or `keras.utils.Sequence` returning `(inputs, targets)` or `(inputs, targets, sample weights)`. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, generator, or `keras.utils.Sequence` instance, `y` should not be specified (since targets will be obtained from `x`).
-
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` if your data is in the form of symbolic tensors, datasets, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intepochs - Integer. Number of epochs to train the model. An epoch is an iteration over the entire `x` and `y` data provided. Note that in conjunction with `initial_epoch`, `epochs` is to be understood as "final epoch". The model is not trained for a number of iterations given by `epochs`, but merely until the epoch of index `epochs` is reached.
-
intverbose - 0, 1, or 2. Verbosity mode. 0 = silent, 1 = progress bar, 2 = one line per epoch. Note that the progress bar is not particularly useful when logged to a file, so verbose=2 is recommended when not running interactively (eg, in a production environment).
-
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances.
List of callbacks to apply during training.
See
tf.keras.callbacks. -
doublevalidation_split - Float between 0 and 1. Fraction of the training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch. The validation data is selected from the last samples in the `x` and `y` data provided, before shuffling. This argument is not supported when `x` is a dataset, generator or `keras.utils.Sequence` instance.
-
Datasetvalidation_data - Data on which to evaluate the loss and any model metrics at the end of each epoch. The model will not be trained on this data. `validation_data` will override `validation_split`. `validation_data` could be: - tuple `(x_val, y_val)` of Numpy arrays or tensors - tuple `(x_val, y_val, val_sample_weights)` of Numpy arrays - dataset For the first two cases, `batch_size` must be provided. For the last case, `validation_steps` must be provided.
-
stringshuffle - Boolean (whether to shuffle the training data before each epoch) or str (for 'batch'). 'batch' is a special option for dealing with the limitations of HDF5 data; it shuffles in batch-sized chunks. Has no effect when `steps_per_epoch` is not `None`.
-
IDictionary<string, string>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) value, used for weighting the loss function (during training only). This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
ndarraysample_weight - Optional Numpy array of weights for the training samples, used for weighting the loss function (during training only). You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape `(samples, sequence_length)`, to apply a different weight to every timestep of every sample. In this case you should make sure to specify `sample_weight_mode="temporal"` in `compile()`. This argument is not supported when `x` is a dataset, generator, or `keras.utils.Sequence` instance, instead provide the sample_weights as the third element of `x`.
-
intinitial_epoch - Integer. Epoch at which to start training (useful for resuming a previous training run).
-
Nullable<int>steps_per_epoch - Integer or `None`.
Total number of steps (batches of samples)
before declaring one epoch finished and starting the
next epoch. When training with input tensors such as
TensorFlow data tensors, the default `None` is equal to
the number of samples in your dataset divided by
the batch size, or 1 if that cannot be determined. If x is a
tf.datadataset, and 'steps_per_epoch' is None, the epoch will run until the input dataset is exhausted. This argument is not supported with array inputs. -
Nullable<int>validation_steps - Only relevant if `validation_data` is provided and
is a
tf.datadataset. Total number of steps (batches of samples) to draw before stopping when performing validation at the end of every epoch. If validation_data is atf.datadataset and 'validation_steps' is None, validation will run until the `validation_data` dataset is exhausted. -
intvalidation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
IDictionary<string, object>kwargs - Used for backwards compatibility.
Returns
-
object - A `History` object. Its `History.history` attribute is a record of training loss values and metrics values at successive epochs, as well as validation loss values and validation metrics values (if applicable).
object fit_generator(Sequence generator, Nullable<int> steps_per_epoch, int epochs, int verbose, IEnumerable<object> callbacks, IEnumerator<ValueTuple<object, object>> validation_data, Nullable<int> validation_steps, int validation_freq, IDictionary<string, object> class_weight, int max_queue_size, int workers, bool use_multiprocessing, bool shuffle, int initial_epoch)
Fits the model on data yielded batch-by-batch by a Python generator. The generator is run in parallel to the model, for efficiency.
For instance, this allows you to do real-time data augmentation
on images on CPU in parallel to training your model on GPU. The use of `keras.utils.Sequence` guarantees the ordering
and guarantees the single use of every input per epoch when
using `use_multiprocessing=True`.
Parameters
-
Sequencegenerator - A generator or an instance of `Sequence` (`keras.utils.Sequence`) object in order to avoid duplicate data when using multiprocessing. The output of the generator must be either - a tuple `(inputs, targets)` - a tuple `(inputs, targets, sample_weights)`. This tuple (a single output of the generator) makes a single batch. Therefore, all arrays in this tuple must have the same length (equal to the size of this batch). Different batches may have different sizes. For example, the last batch of the epoch is commonly smaller than the others, if the size of the dataset is not divisible by the batch size. The generator is expected to loop over its data indefinitely. An epoch finishes when `steps_per_epoch` batches have been seen by the model.
-
Nullable<int>steps_per_epoch - Total number of steps (batches of samples) to yield from `generator` before declaring one epoch finished and starting the next epoch. It should typically be equal to the number of samples of your dataset divided by the batch size. Optional for `Sequence`: if unspecified, will use the `len(generator)` as a number of steps.
-
intepochs - Integer, total number of iterations on the data.
-
intverbose - Verbosity mode, 0, 1, or 2.
-
IEnumerable<object>callbacks - List of callbacks to be called during training.
-
IEnumerator<ValueTuple<object, object>>validation_data - This can be either - a generator for the validation data - a tuple (inputs, targets) - a tuple (inputs, targets, sample_weights).
-
Nullable<int>validation_steps - Only relevant if `validation_data` is a generator. Total number of steps (batches of samples) to yield from `generator` before stopping. Optional for `Sequence`: if unspecified, will use the `len(validation_data)` as a number of steps.
-
intvalidation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
IDictionary<string, object>class_weight - Dictionary mapping class indices to a weight for the class.
-
intmax_queue_size - Integer. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
boolshuffle - Boolean. Whether to shuffle the order of the batches at the beginning of each epoch. Only used with instances of `Sequence` (`keras.utils.Sequence`). Has no effect when `steps_per_epoch` is not `None`.
-
intinitial_epoch - Epoch at which to start training (useful for resuming a previous training run)
Returns
-
object - A `History` object. Example: ```python def generate_arrays_from_file(path): while 1: f = open(path) for line in f: # create numpy arrays of input data # and labels, from each line in the file x1, x2, y = process_line(line) yield ({'input_1': x1, 'input_2': x2}, {'output': y}) f.close() model.fit_generator(generate_arrays_from_file('/my_file.txt'), steps_per_epoch=10000, epochs=10) ```
object fit_generator(Sequence generator, Nullable<int> steps_per_epoch, int epochs, int verbose, IEnumerable<object> callbacks, ValueTuple<IEnumerable<object>, object> validation_data, Nullable<int> validation_steps, int validation_freq, IDictionary<string, object> class_weight, int max_queue_size, int workers, bool use_multiprocessing, bool shuffle, int initial_epoch)
Fits the model on data yielded batch-by-batch by a Python generator. The generator is run in parallel to the model, for efficiency.
For instance, this allows you to do real-time data augmentation
on images on CPU in parallel to training your model on GPU. The use of `keras.utils.Sequence` guarantees the ordering
and guarantees the single use of every input per epoch when
using `use_multiprocessing=True`.
Parameters
-
Sequencegenerator - A generator or an instance of `Sequence` (`keras.utils.Sequence`) object in order to avoid duplicate data when using multiprocessing. The output of the generator must be either - a tuple `(inputs, targets)` - a tuple `(inputs, targets, sample_weights)`. This tuple (a single output of the generator) makes a single batch. Therefore, all arrays in this tuple must have the same length (equal to the size of this batch). Different batches may have different sizes. For example, the last batch of the epoch is commonly smaller than the others, if the size of the dataset is not divisible by the batch size. The generator is expected to loop over its data indefinitely. An epoch finishes when `steps_per_epoch` batches have been seen by the model.
-
Nullable<int>steps_per_epoch - Total number of steps (batches of samples) to yield from `generator` before declaring one epoch finished and starting the next epoch. It should typically be equal to the number of samples of your dataset divided by the batch size. Optional for `Sequence`: if unspecified, will use the `len(generator)` as a number of steps.
-
intepochs - Integer, total number of iterations on the data.
-
intverbose - Verbosity mode, 0, 1, or 2.
-
IEnumerable<object>callbacks - List of callbacks to be called during training.
-
ValueTuple<IEnumerable<object>, object>validation_data - This can be either - a generator for the validation data - a tuple (inputs, targets) - a tuple (inputs, targets, sample_weights).
-
Nullable<int>validation_steps - Only relevant if `validation_data` is a generator. Total number of steps (batches of samples) to yield from `generator` before stopping. Optional for `Sequence`: if unspecified, will use the `len(validation_data)` as a number of steps.
-
intvalidation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
IDictionary<string, object>class_weight - Dictionary mapping class indices to a weight for the class.
-
intmax_queue_size - Integer. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
boolshuffle - Boolean. Whether to shuffle the order of the batches at the beginning of each epoch. Only used with instances of `Sequence` (`keras.utils.Sequence`). Has no effect when `steps_per_epoch` is not `None`.
-
intinitial_epoch - Epoch at which to start training (useful for resuming a previous training run)
Returns
-
object - A `History` object. Example: ```python def generate_arrays_from_file(path): while 1: f = open(path) for line in f: # create numpy arrays of input data # and labels, from each line in the file x1, x2, y = process_line(line) yield ({'input_1': x1, 'input_2': x2}, {'output': y}) f.close() model.fit_generator(generate_arrays_from_file('/my_file.txt'), steps_per_epoch=10000, epochs=10) ```
object fit_generator(IEnumerator<ValueTuple<IEnumerable<object>, object>> generator, Nullable<int> steps_per_epoch, int epochs, int verbose, IEnumerable<object> callbacks, ValueTuple<IEnumerable<object>, object> validation_data, Nullable<int> validation_steps, int validation_freq, IDictionary<string, object> class_weight, int max_queue_size, int workers, bool use_multiprocessing, bool shuffle, int initial_epoch)
Fits the model on data yielded batch-by-batch by a Python generator. The generator is run in parallel to the model, for efficiency.
For instance, this allows you to do real-time data augmentation
on images on CPU in parallel to training your model on GPU. The use of `keras.utils.Sequence` guarantees the ordering
and guarantees the single use of every input per epoch when
using `use_multiprocessing=True`.
Parameters
-
IEnumerator<ValueTuple<IEnumerable<object>, object>>generator - A generator or an instance of `Sequence` (`keras.utils.Sequence`) object in order to avoid duplicate data when using multiprocessing. The output of the generator must be either - a tuple `(inputs, targets)` - a tuple `(inputs, targets, sample_weights)`. This tuple (a single output of the generator) makes a single batch. Therefore, all arrays in this tuple must have the same length (equal to the size of this batch). Different batches may have different sizes. For example, the last batch of the epoch is commonly smaller than the others, if the size of the dataset is not divisible by the batch size. The generator is expected to loop over its data indefinitely. An epoch finishes when `steps_per_epoch` batches have been seen by the model.
-
Nullable<int>steps_per_epoch - Total number of steps (batches of samples) to yield from `generator` before declaring one epoch finished and starting the next epoch. It should typically be equal to the number of samples of your dataset divided by the batch size. Optional for `Sequence`: if unspecified, will use the `len(generator)` as a number of steps.
-
intepochs - Integer, total number of iterations on the data.
-
intverbose - Verbosity mode, 0, 1, or 2.
-
IEnumerable<object>callbacks - List of callbacks to be called during training.
-
ValueTuple<IEnumerable<object>, object>validation_data - This can be either - a generator for the validation data - a tuple (inputs, targets) - a tuple (inputs, targets, sample_weights).
-
Nullable<int>validation_steps - Only relevant if `validation_data` is a generator. Total number of steps (batches of samples) to yield from `generator` before stopping. Optional for `Sequence`: if unspecified, will use the `len(validation_data)` as a number of steps.
-
intvalidation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
IDictionary<string, object>class_weight - Dictionary mapping class indices to a weight for the class.
-
intmax_queue_size - Integer. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
boolshuffle - Boolean. Whether to shuffle the order of the batches at the beginning of each epoch. Only used with instances of `Sequence` (`keras.utils.Sequence`). Has no effect when `steps_per_epoch` is not `None`.
-
intinitial_epoch - Epoch at which to start training (useful for resuming a previous training run)
Returns
-
object - A `History` object. Example: ```python def generate_arrays_from_file(path): while 1: f = open(path) for line in f: # create numpy arrays of input data # and labels, from each line in the file x1, x2, y = process_line(line) yield ({'input_1': x1, 'input_2': x2}, {'output': y}) f.close() model.fit_generator(generate_arrays_from_file('/my_file.txt'), steps_per_epoch=10000, epochs=10) ```
object fit_generator_dyn(object generator, object steps_per_epoch, ImplicitContainer<T> epochs, ImplicitContainer<T> verbose, object callbacks, object validation_data, object validation_steps, ImplicitContainer<T> validation_freq, object class_weight, ImplicitContainer<T> max_queue_size, ImplicitContainer<T> workers, ImplicitContainer<T> use_multiprocessing, ImplicitContainer<T> shuffle, ImplicitContainer<T> initial_epoch)
Fits the model on data yielded batch-by-batch by a Python generator. The generator is run in parallel to the model, for efficiency.
For instance, this allows you to do real-time data augmentation
on images on CPU in parallel to training your model on GPU. The use of `keras.utils.Sequence` guarantees the ordering
and guarantees the single use of every input per epoch when
using `use_multiprocessing=True`.
Parameters
-
objectgenerator - A generator or an instance of `Sequence` (`keras.utils.Sequence`) object in order to avoid duplicate data when using multiprocessing. The output of the generator must be either - a tuple `(inputs, targets)` - a tuple `(inputs, targets, sample_weights)`. This tuple (a single output of the generator) makes a single batch. Therefore, all arrays in this tuple must have the same length (equal to the size of this batch). Different batches may have different sizes. For example, the last batch of the epoch is commonly smaller than the others, if the size of the dataset is not divisible by the batch size. The generator is expected to loop over its data indefinitely. An epoch finishes when `steps_per_epoch` batches have been seen by the model.
-
objectsteps_per_epoch - Total number of steps (batches of samples) to yield from `generator` before declaring one epoch finished and starting the next epoch. It should typically be equal to the number of samples of your dataset divided by the batch size. Optional for `Sequence`: if unspecified, will use the `len(generator)` as a number of steps.
-
ImplicitContainer<T>epochs - Integer, total number of iterations on the data.
-
ImplicitContainer<T>verbose - Verbosity mode, 0, 1, or 2.
-
objectcallbacks - List of callbacks to be called during training.
-
objectvalidation_data - This can be either - a generator for the validation data - a tuple (inputs, targets) - a tuple (inputs, targets, sample_weights).
-
objectvalidation_steps - Only relevant if `validation_data` is a generator. Total number of steps (batches of samples) to yield from `generator` before stopping. Optional for `Sequence`: if unspecified, will use the `len(validation_data)` as a number of steps.
-
ImplicitContainer<T>validation_freq - Only relevant if validation data is provided. Integer or `collections_abc.Container` instance (e.g. list, tuple, etc.). If an integer, specifies how many training epochs to run before a new validation run is performed, e.g. `validation_freq=2` runs validation every 2 epochs. If a Container, specifies the epochs on which to run validation, e.g. `validation_freq=[1, 2, 10]` runs validation at the end of the 1st, 2nd, and 10th epochs.
-
objectclass_weight - Dictionary mapping class indices to a weight for the class.
-
ImplicitContainer<T>max_queue_size - Integer. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
ImplicitContainer<T>workers - Integer. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
ImplicitContainer<T>use_multiprocessing - Boolean. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
ImplicitContainer<T>shuffle - Boolean. Whether to shuffle the order of the batches at the beginning of each epoch. Only used with instances of `Sequence` (`keras.utils.Sequence`). Has no effect when `steps_per_epoch` is not `None`.
-
ImplicitContainer<T>initial_epoch - Epoch at which to start training (useful for resuming a previous training run)
Returns
-
object - A `History` object. Example: ```python def generate_arrays_from_file(path): while 1: f = open(path) for line in f: # create numpy arrays of input data # and labels, from each line in the file x1, x2, y = process_line(line) yield ({'input_1': x1, 'input_2': x2}, {'output': y}) f.close() model.fit_generator(generate_arrays_from_file('/my_file.txt'), steps_per_epoch=10000, epochs=10) ```
IList<object> get_input_at(int node_index)
Retrieves the input tensor(s) of a layer at a given node.
Parameters
-
intnode_index - Integer, index of the node from which to retrieve the attribute. E.g. `node_index=0` will correspond to the first time the layer was called.
Returns
-
IList<object> - A tensor (or list of tensors if the layer has multiple inputs).
object get_input_at_dyn(object node_index)
Retrieves the input tensor(s) of a layer at a given node.
Parameters
-
objectnode_index - Integer, index of the node from which to retrieve the attribute. E.g. `node_index=0` will correspond to the first time the layer was called.
Returns
-
object - A tensor (or list of tensors if the layer has multiple inputs).
object get_input_mask_at(int node_index)
Retrieves the input mask tensor(s) of a layer at a given node.
Parameters
-
intnode_index - Integer, index of the node from which to retrieve the attribute. E.g. `node_index=0` will correspond to the first time the layer was called.
Returns
-
object - A mask tensor (or list of tensors if the layer has multiple inputs).
object get_input_mask_at_dyn(object node_index)
Retrieves the input mask tensor(s) of a layer at a given node.
Parameters
-
objectnode_index - Integer, index of the node from which to retrieve the attribute. E.g. `node_index=0` will correspond to the first time the layer was called.
Returns
-
object - A mask tensor (or list of tensors if the layer has multiple inputs).
IList<object> get_input_shape_at(int node_index)
Retrieves the input shape(s) of a layer at a given node.
Parameters
-
intnode_index - Integer, index of the node from which to retrieve the attribute. E.g. `node_index=0` will correspond to the first time the layer was called.
Returns
-
IList<object> - A shape tuple (or list of shape tuples if the layer has multiple inputs).
object get_input_shape_at_dyn(object node_index)
Retrieves the input shape(s) of a layer at a given node.
Parameters
-
objectnode_index - Integer, index of the node from which to retrieve the attribute. E.g. `node_index=0` will correspond to the first time the layer was called.
Returns
-
object - A shape tuple (or list of shape tuples if the layer has multiple inputs).
object get_layer(string name, object index)
object get_layer_dyn(object name, object index)
IList<object> get_losses_for(IDictionary<object, object> inputs)
Retrieves losses relevant to a specific set of inputs.
Parameters
-
IDictionary<object, object>inputs - Input tensor or list/tuple of input tensors.
Returns
-
IList<object> - List of loss tensors of the layer that depend on `inputs`.
IList<object> get_losses_for(IGraphNodeBase inputs)
Retrieves losses relevant to a specific set of inputs.
Parameters
-
IGraphNodeBaseinputs - Input tensor or list/tuple of input tensors.
Returns
-
IList<object> - List of loss tensors of the layer that depend on `inputs`.
IList<object> get_losses_for(IEnumerable<object> inputs)
Retrieves losses relevant to a specific set of inputs.
Parameters
-
IEnumerable<object>inputs - Input tensor or list/tuple of input tensors.
Returns
-
IList<object> - List of loss tensors of the layer that depend on `inputs`.
object get_losses_for_dyn(object inputs)
Retrieves losses relevant to a specific set of inputs.
Parameters
-
objectinputs - Input tensor or list/tuple of input tensors.
Returns
-
object - List of loss tensors of the layer that depend on `inputs`.
IList<object> get_output_at(int node_index)
Retrieves the output tensor(s) of a layer at a given node.
Parameters
-
intnode_index - Integer, index of the node from which to retrieve the attribute. E.g. `node_index=0` will correspond to the first time the layer was called.
Returns
-
IList<object> - A tensor (or list of tensors if the layer has multiple outputs).
object get_output_at_dyn(object node_index)
Retrieves the output tensor(s) of a layer at a given node.
Parameters
-
objectnode_index - Integer, index of the node from which to retrieve the attribute. E.g. `node_index=0` will correspond to the first time the layer was called.
Returns
-
object - A tensor (or list of tensors if the layer has multiple outputs).
object get_output_mask_at(int node_index)
Retrieves the output mask tensor(s) of a layer at a given node.
Parameters
-
intnode_index - Integer, index of the node from which to retrieve the attribute. E.g. `node_index=0` will correspond to the first time the layer was called.
Returns
-
object - A mask tensor (or list of tensors if the layer has multiple outputs).
object get_output_mask_at_dyn(object node_index)
Retrieves the output mask tensor(s) of a layer at a given node.
Parameters
-
objectnode_index - Integer, index of the node from which to retrieve the attribute. E.g. `node_index=0` will correspond to the first time the layer was called.
Returns
-
object - A mask tensor (or list of tensors if the layer has multiple outputs).
IList<object> get_output_shape_at(int node_index)
Retrieves the output shape(s) of a layer at a given node.
Parameters
-
intnode_index - Integer, index of the node from which to retrieve the attribute. E.g. `node_index=0` will correspond to the first time the layer was called.
Returns
-
IList<object> - A shape tuple (or list of shape tuples if the layer has multiple outputs).
object get_output_shape_at_dyn(object node_index)
Retrieves the output shape(s) of a layer at a given node.
Parameters
-
objectnode_index - Integer, index of the node from which to retrieve the attribute. E.g. `node_index=0` will correspond to the first time the layer was called.
Returns
-
object - A shape tuple (or list of shape tuples if the layer has multiple outputs).
object get_weights_()
object get_weights_dyn_()
object predict(IEnumerable<IGraphNodeBase> x, Nullable<int> batch_size, bool verbose, Nullable<int> steps, IEnumerable<Callback> callbacks, IEnumerable<Callback> max_queue_size, int workers, bool use_multiprocessing)
Generates output predictions for the input samples. Computation is done in batches.
Parameters
-
IEnumerable<IGraphNodeBase>x - Input samples. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
boolverbose - Verbosity mode, 0 or 1.
-
Nullable<int>steps - Total number of steps (batches of samples)
before declaring the prediction round finished.
Ignored with the default value of `None`. If x is a
tf.datadataset and `steps` is None, `predict` will run until the input dataset is exhausted. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during prediction. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
IEnumerable<Callback>max_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Numpy array(s) of predictions.
object predict(object x, Nullable<int> batch_size, int verbose, Nullable<int> steps, IEnumerable<Callback> callbacks, int max_queue_size, int workers, bool use_multiprocessing)
Generates output predictions for the input samples. Computation is done in batches.
Parameters
-
objectx - Input samples. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intverbose - Verbosity mode, 0 or 1.
-
Nullable<int>steps - Total number of steps (batches of samples)
before declaring the prediction round finished.
Ignored with the default value of `None`. If x is a
tf.datadataset and `steps` is None, `predict` will run until the input dataset is exhausted. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during prediction. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Numpy array(s) of predictions.
object predict(IEnumerable<IGraphNodeBase> x, Nullable<int> batch_size, bool verbose, Nullable<int> steps, IEnumerable<Callback> callbacks, int max_queue_size, int workers, bool use_multiprocessing)
Generates output predictions for the input samples. Computation is done in batches.
Parameters
-
IEnumerable<IGraphNodeBase>x - Input samples. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
boolverbose - Verbosity mode, 0 or 1.
-
Nullable<int>steps - Total number of steps (batches of samples)
before declaring the prediction round finished.
Ignored with the default value of `None`. If x is a
tf.datadataset and `steps` is None, `predict` will run until the input dataset is exhausted. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during prediction. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Numpy array(s) of predictions.
object predict(object x, Nullable<int> batch_size, bool verbose, Nullable<int> steps, IEnumerable<Callback> callbacks, int max_queue_size, int workers, bool use_multiprocessing)
Generates output predictions for the input samples. Computation is done in batches.
Parameters
-
objectx - Input samples. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
boolverbose - Verbosity mode, 0 or 1.
-
Nullable<int>steps - Total number of steps (batches of samples)
before declaring the prediction round finished.
Ignored with the default value of `None`. If x is a
tf.datadataset and `steps` is None, `predict` will run until the input dataset is exhausted. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during prediction. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Numpy array(s) of predictions.
object predict(IEnumerable<IGraphNodeBase> x, Nullable<int> batch_size, int verbose, Nullable<int> steps, IEnumerable<Callback> callbacks, IEnumerable<Callback> max_queue_size, int workers, bool use_multiprocessing)
Generates output predictions for the input samples. Computation is done in batches.
Parameters
-
IEnumerable<IGraphNodeBase>x - Input samples. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intverbose - Verbosity mode, 0 or 1.
-
Nullable<int>steps - Total number of steps (batches of samples)
before declaring the prediction round finished.
Ignored with the default value of `None`. If x is a
tf.datadataset and `steps` is None, `predict` will run until the input dataset is exhausted. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during prediction. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
IEnumerable<Callback>max_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Numpy array(s) of predictions.
object predict(IEnumerable<IGraphNodeBase> x, Nullable<int> batch_size, int verbose, Nullable<int> steps, IEnumerable<Callback> callbacks, int max_queue_size, int workers, bool use_multiprocessing)
Generates output predictions for the input samples. Computation is done in batches.
Parameters
-
IEnumerable<IGraphNodeBase>x - Input samples. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intverbose - Verbosity mode, 0 or 1.
-
Nullable<int>steps - Total number of steps (batches of samples)
before declaring the prediction round finished.
Ignored with the default value of `None`. If x is a
tf.datadataset and `steps` is None, `predict` will run until the input dataset is exhausted. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during prediction. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Numpy array(s) of predictions.
object predict(object x, Nullable<int> batch_size, bool verbose, Nullable<int> steps, IEnumerable<Callback> callbacks, IEnumerable<Callback> max_queue_size, int workers, bool use_multiprocessing)
Generates output predictions for the input samples. Computation is done in batches.
Parameters
-
objectx - Input samples. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
boolverbose - Verbosity mode, 0 or 1.
-
Nullable<int>steps - Total number of steps (batches of samples)
before declaring the prediction round finished.
Ignored with the default value of `None`. If x is a
tf.datadataset and `steps` is None, `predict` will run until the input dataset is exhausted. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during prediction. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
IEnumerable<Callback>max_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Numpy array(s) of predictions.
object predict(object x, Nullable<int> batch_size, int verbose, Nullable<int> steps, IEnumerable<Callback> callbacks, IEnumerable<Callback> max_queue_size, int workers, bool use_multiprocessing)
Generates output predictions for the input samples. Computation is done in batches.
Parameters
-
objectx - Input samples. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
Nullable<int>batch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
intverbose - Verbosity mode, 0 or 1.
-
Nullable<int>steps - Total number of steps (batches of samples)
before declaring the prediction round finished.
Ignored with the default value of `None`. If x is a
tf.datadataset and `steps` is None, `predict` will run until the input dataset is exhausted. -
IEnumerable<Callback>callbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during prediction. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
IEnumerable<Callback>max_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
intworkers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Numpy array(s) of predictions.
object predict_dyn(object x, object batch_size, ImplicitContainer<T> verbose, object steps, object callbacks, ImplicitContainer<T> max_queue_size, ImplicitContainer<T> workers, ImplicitContainer<T> use_multiprocessing)
Generates output predictions for the input samples. Computation is done in batches.
Parameters
-
objectx - Input samples. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A
tf.datadataset. - A generator or `keras.utils.Sequence` instance. -
objectbatch_size - Integer or `None`. Number of samples per gradient update. If unspecified, `batch_size` will default to 32. Do not specify the `batch_size` is your data is in the form of symbolic tensors, dataset, generators, or `keras.utils.Sequence` instances (since they generate batches).
-
ImplicitContainer<T>verbose - Verbosity mode, 0 or 1.
-
objectsteps - Total number of steps (batches of samples)
before declaring the prediction round finished.
Ignored with the default value of `None`. If x is a
tf.datadataset and `steps` is None, `predict` will run until the input dataset is exhausted. -
objectcallbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during prediction. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
ImplicitContainer<T>max_queue_size - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum size for the generator queue. If unspecified, `max_queue_size` will default to 10.
-
ImplicitContainer<T>workers - Integer. Used for generator or `keras.utils.Sequence` input only. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
ImplicitContainer<T>use_multiprocessing - Boolean. Used for generator or `keras.utils.Sequence` input only. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
Returns
-
object - Numpy array(s) of predictions.
object predict_generator(IEnumerator<object> generator, Nullable<int> steps, object callbacks, int max_queue_size, int workers, bool use_multiprocessing, int verbose)
Generates predictions for the input samples from a data generator. The generator should return the same kind of data as accepted by
`predict_on_batch`.
Parameters
-
IEnumerator<object>generator - Generator yielding batches of input samples or an instance of `keras.utils.Sequence` object in order to avoid duplicate data when using multiprocessing.
-
Nullable<int>steps - Total number of steps (batches of samples) to yield from `generator` before stopping. Optional for `Sequence`: if unspecified, will use the `len(generator)` as a number of steps.
-
objectcallbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during prediction. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
intmax_queue_size - Maximum size for the generator queue.
-
intworkers - Integer. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
booluse_multiprocessing - Boolean. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
intverbose - verbosity mode, 0 or 1.
Returns
-
object - Numpy array(s) of predictions.
object predict_generator_dyn(object generator, object steps, object callbacks, ImplicitContainer<T> max_queue_size, ImplicitContainer<T> workers, ImplicitContainer<T> use_multiprocessing, ImplicitContainer<T> verbose)
Generates predictions for the input samples from a data generator. The generator should return the same kind of data as accepted by
`predict_on_batch`.
Parameters
-
objectgenerator - Generator yielding batches of input samples or an instance of `keras.utils.Sequence` object in order to avoid duplicate data when using multiprocessing.
-
objectsteps - Total number of steps (batches of samples) to yield from `generator` before stopping. Optional for `Sequence`: if unspecified, will use the `len(generator)` as a number of steps.
-
objectcallbacks - List of `keras.callbacks.Callback` instances. List of callbacks to apply during prediction. See [callbacks](/api_docs/python/tf/keras/callbacks).
-
ImplicitContainer<T>max_queue_size - Maximum size for the generator queue.
-
ImplicitContainer<T>workers - Integer. Maximum number of processes to spin up when using process-based threading. If unspecified, `workers` will default to 1. If 0, will execute the generator on the main thread.
-
ImplicitContainer<T>use_multiprocessing - Boolean. If `True`, use process-based threading. If unspecified, `use_multiprocessing` will default to `False`. Note that because this implementation relies on multiprocessing, you should not pass non-picklable arguments to the generator as they can't be passed easily to children processes.
-
ImplicitContainer<T>verbose - verbosity mode, 0 or 1.
Returns
-
object - Numpy array(s) of predictions.
void reset_metrics()
Resets the state of metrics.
object reset_metrics_dyn()
Resets the state of metrics.
void reset_states()
Resets all of the metric state variables. This function is called between epochs/steps,
when a metric is evaluated during training.
object reset_states_dyn()
Resets all of the metric state variables. This function is called between epochs/steps,
when a metric is evaluated during training.
object save(IGraphNodeBase filepath, bool overwrite, bool include_optimizer, string save_format, object signatures)
object save(string filepath, bool overwrite, bool include_optimizer, string save_format, object signatures)
object save(Byte[] filepath, bool overwrite, bool include_optimizer, string save_format, object signatures)
object test_on_batch(IDictionary<string, object> x, IEnumerable<object> y, IDictionary<string, object> sample_weight, bool reset_metrics)
Test the model on a single batch of samples.
Parameters
-
IDictionary<string, object>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IEnumerable<object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object test_on_batch(IDictionary<string, object> x, IGraphNodeBase y, IDictionary<string, object> sample_weight, bool reset_metrics)
Test the model on a single batch of samples.
Parameters
-
IDictionary<string, object>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IGraphNodeBasey - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object test_on_batch(IDictionary<string, object> x, IEnumerable<object> y, ndarray sample_weight, bool reset_metrics)
Test the model on a single batch of samples.
Parameters
-
IDictionary<string, object>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IEnumerable<object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object test_on_batch(IDictionary<string, object> x, IGraphNodeBase y, ndarray sample_weight, bool reset_metrics)
Test the model on a single batch of samples.
Parameters
-
IDictionary<string, object>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IGraphNodeBasey - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object test_on_batch(ndarray x, ndarray y, ndarray sample_weight, bool reset_metrics)
Test the model on a single batch of samples.
Parameters
-
ndarrayx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
ndarrayy - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object test_on_batch(IDictionary<string, object> x, ndarray y, IDictionary<string, object> sample_weight, bool reset_metrics)
Test the model on a single batch of samples.
Parameters
-
IDictionary<string, object>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
ndarrayy - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object test_on_batch(IDictionary<string, object> x, ndarray y, ndarray sample_weight, bool reset_metrics)
Test the model on a single batch of samples.
Parameters
-
IDictionary<string, object>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
ndarrayy - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object test_on_batch(ndarray x, IGraphNodeBase y, IDictionary<string, object> sample_weight, bool reset_metrics)
Test the model on a single batch of samples.
Parameters
-
ndarrayx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IGraphNodeBasey - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object test_on_batch(ndarray x, IGraphNodeBase y, ndarray sample_weight, bool reset_metrics)
Test the model on a single batch of samples.
Parameters
-
ndarrayx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IGraphNodeBasey - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object test_on_batch(ndarray x, IEnumerable<object> y, IDictionary<string, object> sample_weight, bool reset_metrics)
Test the model on a single batch of samples.
Parameters
-
ndarrayx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IEnumerable<object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object test_on_batch(ndarray x, IEnumerable<object> y, ndarray sample_weight, bool reset_metrics)
Test the model on a single batch of samples.
Parameters
-
ndarrayx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IEnumerable<object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object test_on_batch(ndarray x, ndarray y, IDictionary<string, object> sample_weight, bool reset_metrics)
Test the model on a single batch of samples.
Parameters
-
ndarrayx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
ndarrayy - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(object x, ndarray y, ndarray sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
ndarrayy - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(IEnumerable<IGraphNodeBase> x, IGraphNodeBase y, IDictionary<string, object> sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
IEnumerable<IGraphNodeBase>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IGraphNodeBasey - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(IEnumerable<IGraphNodeBase> x, IGraphNodeBase y, ndarray sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
IEnumerable<IGraphNodeBase>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IGraphNodeBasey - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(IEnumerable<IGraphNodeBase> x, IEnumerable<object> y, IDictionary<string, object> sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
IEnumerable<IGraphNodeBase>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IEnumerable<object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(IEnumerable<IGraphNodeBase> x, IEnumerable<object> y, ndarray sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
IEnumerable<IGraphNodeBase>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IEnumerable<object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(IEnumerable<IGraphNodeBase> x, IDictionary<string, object> y, IDictionary<string, object> sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
IEnumerable<IGraphNodeBase>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IDictionary<string, object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(IEnumerable<IGraphNodeBase> x, ndarray y, IDictionary<string, object> sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
IEnumerable<IGraphNodeBase>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
ndarrayy - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(object x, ndarray y, IDictionary<string, object> sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
ndarrayy - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(object x, IDictionary<string, object> y, ndarray sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IDictionary<string, object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(object x, IEnumerable<object> y, IDictionary<string, object> sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IEnumerable<object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(object x, IEnumerable<object> y, ndarray sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IEnumerable<object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(IEnumerable<IGraphNodeBase> x, ndarray y, ndarray sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
IEnumerable<IGraphNodeBase>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
ndarrayy - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(IEnumerable<IGraphNodeBase> x, IDictionary<string, object> y, ndarray sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
IEnumerable<IGraphNodeBase>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IDictionary<string, object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(object x, IGraphNodeBase y, ndarray sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IGraphNodeBasey - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(object x, IGraphNodeBase y, IDictionary<string, object> sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IGraphNodeBasey - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(object x, object y, ndarray sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(object x, object y, IDictionary<string, object> sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(IEnumerable<IGraphNodeBase> x, object y, ndarray sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
IEnumerable<IGraphNodeBase>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
ndarraysample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(object x, IDictionary<string, object> y, IDictionary<string, object> sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
IDictionary<string, object>y - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch(IEnumerable<IGraphNodeBase> x, object y, IDictionary<string, object> sample_weight, IDictionary<int, double> class_weight, bool reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
IEnumerable<IGraphNodeBase>x - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
IDictionary<string, object>sample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
IDictionary<int, double>class_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
boolreset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.
object train_on_batch_dyn(object x, object y, object sample_weight, object class_weight, ImplicitContainer<T> reset_metrics)
Runs a single gradient update on a single batch of data.
Parameters
-
objectx - Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in case the model has multiple inputs).
- A dict mapping input names to the corresponding array/tensors,
if the model has named inputs.
- A
tf.datadataset. -
objecty - Target data. Like the input data `x`, it could be either Numpy array(s) or TensorFlow tensor(s). It should be consistent with `x` (you cannot have Numpy inputs and tensor targets, or inversely). If `x` is a dataset, `y` should not be specified (since targets will be obtained from the iterator).
-
objectsample_weight - Optional array of the same length as x, containing weights to apply to the model's loss for each sample. In the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile(). This argument is not supported when `x` is a dataset.
-
objectclass_weight - Optional dictionary mapping class indices (integers) to a weight (float) to apply to the model's loss for the samples from this class during training. This can be useful to tell the model to "pay more attention" to samples from an under-represented class.
-
ImplicitContainer<T>reset_metrics - If `True`, the metrics returned will be only for this batch. If `False`, the metrics will be statefully accumulated across batches.
Returns
-
object - Scalar training loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute `model.metrics_names` will give you the display labels for the scalar outputs.