# tf_agents.bandits.environments.non_stationary_stochastic_environment.EnvironmentDynamics

<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/bandits/environments/non_stationary_stochastic_environment.py#L32-L90) |

Abstract class to represent a non-stationary environment dynamics.

    tf_agents.bandits.environments.non_stationary_stochastic_environment.EnvironmentDynamics(
        name=None
    )

This class is used with the NonStationaryStochasticEnvironment class below to
obtain a non-stationary environment.
To define a dynamics, derive from this class and define the abstract methods
and properties below.
To work correctly with graph and eager mode, Tensorflow variables must be
defined in the constructor of this class. When used within a
`BanditTFEnvironment` autodeps in reset and step functions will handle
automatically the operation order.

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `action_spec` | Specification of the actions. |
| `batch_size` | Returns the batch size used for observations and rewards. |
| `observation_spec` | Specification of the observations. |

<br />

## Methods

### `observation`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/bandits/environments/non_stationary_stochastic_environment.py#L61-L72)

    @abc.abstractmethod
    observation(
        env_time: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Int
    ) -> https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/NestedTensor

Returns an observation batch for the given time.

<br />

<br />

<br />

| Args ||
|---|---|
| `env_time` | The scalar int64 tensor of the environment time step. This is incremented by the environment after the reward is computed. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| The observation batch with spec according to `observation_spec.` ||

<br />

### `reward`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/bandits/environments/non_stationary_stochastic_environment.py#L74-L90)

    @abc.abstractmethod
    reward(
        observation: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/NestedTensor,
        env_time: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Int
    ) -> https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/NestedTensor

Reward for the given observation and time step.

<br />

<br />

<br />

| Args ||
|---|---|
| `observation` | A batch of observations with spec according to `observation_spec.` |
| `env_time` | The scalar int64 tensor of the environment time step. This is incremented by the environment after the reward is computed. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A batch of rewards with spec shape \[batch_size, num_actions\] containing rewards for all arms. ||

<br />