class_docstr: Mock policy takes actions 1 and 2, alternating.
class_docstr_tok: ["Mock","policy","takes","actions","1","and","2",",","alternating","."]
code: def _action(self, time_step, policy_state):
      # Reset the policy when starting a new episode.
      is_time_step_first = time_step.is_first()
      if np.isscalar(is_time_step_first):
          if is_time_step_first:
              policy_state = self._initial_policy_state
      else:
          policy_state[is_time_step_first] = self._initial_policy_state[
              is_time_step_first
          ]
  
      # Take actions 1 and 2 alternating.
      action = (policy_state % 2) + 1
      policy_info = np.int32(action * 2)
      action = np.int32(action)
      policy_state = np.int32(policy_state + 1)
      return policy_step.PolicyStep(action, policy_state, policy_info)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Any
  import numpy
  import tensorflow
  from tf_agents import specs
  from tf_agents.environments import py_environment
  from tf_agents.policies import py_policy
  from tf_agents.policies import tf_policy
  from tf_agents.replay_buffers import tf_uniform_replay_buffer
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import policy_step
  from tf_agents.trajectories import time_step
  from tf_agents.trajectories import trajectory
  from tf_agents.utils import common
label_desc: Use image node_id 3 for calling the PyPolicyMock obj's underlying member method code with example usage: obj._action(time_step, policy_state) and returns: policy_step