# Module: tf_agents.policies.utils

<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/policies/utils.py) |

Utilities for policies.

## Classes

[`class BanditPolicyType`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/BanditPolicyType): Enumeration of bandit policy types.

[`class InfoFields`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/InfoFields): Strings which can be used in the policy info fields.

[`class PerArmPolicyInfo`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/PerArmPolicyInfo): PerArmPolicyInfo(log_probability, predicted_rewards_mean, multiobjective_scalarized_predicted_rewards_mean, predicted_rewards_optimistic, predicted_rewards_sampled, bandit_policy_type, chosen_arm_features)

[`class PolicyInfo`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/PolicyInfo): PolicyInfo(log_probability, predicted_rewards_mean, multiobjective_scalarized_predicted_rewards_mean, predicted_rewards_optimistic, predicted_rewards_sampled, bandit_policy_type)

## Functions

[`bandit_policy_uniform_mask(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/bandit_policy_uniform_mask): Set bandit policy type tensor to BanditPolicyType.UNIFORM based on mask.

[`check_no_mask_with_arm_features(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/check_no_mask_with_arm_features)

[`create_bandit_policy_type_tensor_spec(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/create_bandit_policy_type_tensor_spec): Create tensor spec for bandit policy type.

[`create_chosen_arm_features_info_spec(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/create_chosen_arm_features_info_spec): Creates the chosen arm features info spec from the arm observation spec.

[`get_model_index(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/get_model_index): Returns the model index for a specific arm.

[`get_num_actions_from_tensor_spec(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/get_num_actions_from_tensor_spec): Validates `action_spec` and returns number of actions.

[`has_bandit_policy_type(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/has_bandit_policy_type): Check if policy info has `bandit_policy_type` field/tensor.

[`has_chosen_arm_features(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/has_chosen_arm_features): Check if policy info has `chosen_arm_features` field/tensor.

[`masked_argmax(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/masked_argmax): Computes the argmax where the allowed elements are given by a mask.

[`populate_policy_info(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/populate_policy_info): Populates policy info given all needed input.

[`set_bandit_policy_type(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/policies/utils/set_bandit_policy_type): Sets the InfoFields.BANDIT_POLICY_TYPE on info to bandit_policy_type.

<br />

<br />

<br />

| ## Other Members ||
|---|---|
| absolute_import | Instance of `__future__._Feature` |
| division | Instance of `__future__._Feature` |
| print_function | Instance of `__future__._Feature` |

<br />