# tf_agents.trajectories.single_step

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/trajectories/trajectory.py#L385-L423) |

Create a Trajectory transitioning between StepTypes `FIRST` and `LAST`.

#### View aliases


**Main aliases**

[`tf_agents.trajectories.trajectory.single_step`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/single_step)

<br />

    tf_agents.trajectories.single_step(
        observation: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/NestedSpecTensorOrArray,
        action: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/NestedSpecTensorOrArray,
        policy_info: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/NestedSpecTensorOrArray,
        reward: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/NestedSpecTensorOrArray,
        discount: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/SpecTensorOrArray
    ) -> https://www.tensorflow.org/agents/api_docs/python/tf_agents/trajectories/Trajectory

All inputs may be batched.

The input `discount` is used to infer the outer shape of the inputs,
as it is always expected to be a singleton array with scalar inner shape.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `observation` | (possibly nested tuple of) `Tensor` or `np.ndarray`; all shaped `[B, ...]`, `[T, ...]`, or `[B, T, ...]`. |
| `action` | (possibly nested tuple of) `Tensor` or `np.ndarray`; all shaped `[B, ...]`, `[T, ...]`, or `[B, T, ...]`. |
| `policy_info` | (possibly nested tuple of) `Tensor` or `np.ndarray`; all shaped `[B, ...]`, `[T, ...]`, or `[B, T, ...]`. |
| `reward` | (possibly nested tuple of) `Tensor` or `np.ndarray`; all shaped `[B, ...]`, `[T, ...]`, or `[B, T, ...]`. |
| `discount` | A floating point vector `Tensor` or `np.ndarray`; shaped `[B]`, `[T]`, or `[B, T]` (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `Trajectory` instance. ||

<br />