Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tf_agents.bandits.agents.utils.get_num_actions_from_tensor_spec

View source on GitHub

Validates action_spec and returns number of actions.

tf_agents.bandits.agents.utils.get_num_actions_from_tensor_spec(
    action_spec
)

action_spec must specify a scalar int32 or int64 with minimum zero.

Args:

  • action_spec: a TensorSpec.

Returns:

The number of actions described by action_spec.

Raises:

  • ValueError: if action_spec is not an bounded scalar int32 or int64 spec with minimum 0.