# tf.contrib.distribute.StandardSingleLossStep

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/distribute/step_fn.py#L61-L114) |

A step function that implements a training step for a feed forward network.

Inherits From: [`StandardInputStep`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/distribute/StandardInputStep)

    tf.contrib.distribute.StandardSingleLossStep(
        dataset_fn, loss_fn, optimizer, distribution, iterations_per_step=1
    )

An instance of this class is intended to be used as a callable:

    ...
    step = step_fn.StandardSingleLossStep(
        dataset, loss_fn, optimizer, distribution)

    # Run a single training step on a given DistributionStrategy:
    step(distribution)
    ...

<br />

<br />

<br />

| ## Args ||
|---|---|
| `dataset_fn` | a function that returns a tf.data Dataset that produces the input for the model. |
| `loss_fn` | a function that takes a context and inputs as arguments. It returns the loss for those inputs. `context` is an instance of `values.MultiStepContext` that will be passed when `loss_fn` is run. `context` can be used to specify the outputs to be returned from `loss_fn`, among other things. |
| `optimizer` | an optimizer that implements an update rule. |
| `distribution` | a `DistributionStrategy` object. |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `distribution` | <br /> <br /> |

<br />

## Methods

### `initialize`

[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/distribute/step_fn.py#L57-L58)

    initialize()

### `__call__`

[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/distribute/step_fn.py#L95-L114)

    __call__()

Perform one step of this training algorithm.