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.
Attributes |
action_spec
|
Specification of the actions.
|
batch_size
|
Returns the batch size used for observations and rewards.
|
observation_spec
|
Specification of the observations.
|
Methods
observation
View source
@abc.abstractmethod
observation(
env_time: tf_agents.typing.types.Int
) -> tf_agents.typing.types.NestedTensor
Returns an observation batch for the given time.
Args |
env_time
|
The scalar int64 tensor of the environment time step. This is
incremented by the environment after the reward is computed.
|
Returns |
The observation batch with spec according to observation_spec.
|
reward
View source
@abc.abstractmethod
reward(
observation: tf_agents.typing.types.NestedTensor
,
env_time: tf_agents.typing.types.Int
) -> tf_agents.typing.types.NestedTensor
Reward for the given observation and time step.
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.
|
Returns |
A batch of rewards with spec shape [batch_size, num_actions] containing
rewards for all arms.
|