There cannot be newlines in Args, Returns, Raises section, because in markdown that's a paragraph and the website render comes out wrong. See https://www.tensorflow.org/api_docs/python/tf/keras/Sequential?version=nightly#arguments_3

PiperOrigin-RevId: 291990085
Change-Id: Ic698330b7939c3847fca0d6dbfe4a610569b873c
This commit is contained in:
Yash Katariya 2020-01-28 12:28:49 -08:00 committed by TensorFlower Gardener
parent 805ca9e0f0
commit 5467eb43e7

View File

@ -236,7 +236,6 @@ class Model(network.Network, version_utils.VersionSelector):
See `tf.keras.optimizers`. See `tf.keras.optimizers`.
loss: String (name of objective function), objective function or loss: String (name of objective function), objective function or
`tf.keras.losses.Loss` instance. See `tf.keras.losses`. `tf.keras.losses.Loss` instance. See `tf.keras.losses`.
An objective function is any callable with the signature An objective function is any callable with the signature
`loss = fn(y_true, y_pred)`, where `loss = fn(y_true, y_pred)`, where
y_true = ground truth values with shape = `[batch_size, d0, .. dN]`, y_true = ground truth values with shape = `[batch_size, d0, .. dN]`,
@ -244,23 +243,19 @@ class Model(network.Network, version_utils.VersionSelector):
where shape = `[batch_size, d0, .. dN-1]`. where shape = `[batch_size, d0, .. dN-1]`.
y_pred = predicted values with shape = `[batch_size, d0, .. dN]`. y_pred = predicted values with shape = `[batch_size, d0, .. dN]`.
It returns a weighted loss float tensor. It returns a weighted loss float tensor.
If a custom `Loss` instance is used and reduction is set to NONE, If a custom `Loss` instance is used and reduction is set to NONE,
return value has the shape [batch_size, d0, .. dN-1] ie. per-sample return value has the shape [batch_size, d0, .. dN-1] ie. per-sample
or per-timestep loss values; otherwise, it is a scalar. or per-timestep loss values; otherwise, it is a scalar.
If the model has multiple outputs, you can use a different loss on 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 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 value that will be minimized by the model will then be the sum of
all individual losses. all individual losses.
metrics: List of metrics to be evaluated by the model during training metrics: List of metrics to be evaluated by the model during training
and testing. and testing.
Each of this can be a string (name of a built-in function), function Each of this can be a string (name of a built-in function), function
or a `tf.keras.metrics.Metric` instance. See `tf.keras.metrics`. or a `tf.keras.metrics.Metric` instance. See `tf.keras.metrics`.
Typically you will use `metrics=['accuracy']`. A function is any Typically you will use `metrics=['accuracy']`. A function is any
callable with the signature `result = fn(y_true, y_pred)`. callable with the signature `result = fn(y_true, y_pred)`.
To specify different metrics for different outputs of a To specify different metrics for different outputs of a
multi-output model, you could also pass a dictionary, such as multi-output model, you could also pass a dictionary, such as
`metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`. `metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}`.