code: def testComparisonWithNumpy(
      self, batch_size, use_decomposition, alpha
  ):
      eig_matrix_list = ()
      eig_vals_list = ()
      if use_decomposition:
          eig_vals_one_arm, eig_matrix_one_arm = tf.linalg.eigh(
              self._a[0]
          )
          eig_vals_list = [eig_vals_one_arm] * self._num_actions
          eig_matrix_list = [eig_matrix_one_arm] * self._num_actions
  
      a_inv = []
      theta = []
      for k in range(self._num_actions):
          a_inv.append(
              np.linalg.inv(self._a_numpy[k] + np.eye(self._obs_dim))
          )
          theta.append(
              np.matmul(
                  a_inv[k], self._b_numpy[k].reshape([self._obs_dim, 1])
              )
          )
  
      policy = linear_policy.LinearBanditPolicy(
          self._action_spec,
          self._a,
          self._b,
          self._num_samples_per_arm,
          self._time_step_spec,
          alpha=alpha,
          theta=None
          if alpha > 0.0
          else tf.squeeze(
              tf.cast(tf.stack(theta), dtype=self._obs_spec.dtype),
              axis=-1,
          ),
          eig_vals=eig_vals_list,
          eig_matrix=eig_matrix_list,
      )
  
      action_step = policy.action(
          self._time_step_batch(batch_size=batch_size)
      )
      self.assertEqual(action_step.action.shape.as_list(), [batch_size])
      self.assertEqual(action_step.action.dtype, tf.int32)
      actions_ = self.evaluate(action_step.action)
  
      observation_numpy = np.array(
          range(batch_size * self._obs_dim), dtype=np.float32
      ).reshape([batch_size, self._obs_dim])
  
      p_values = []
      for k in range(self._num_actions):
          confidence_intervals = np.sqrt(
              np.diag(
                  np.matmul(
                      observation_numpy,
                      np.matmul(
                          a_inv[k], np.transpose(observation_numpy)
                      ),
                  )
              )
          )
          p_value = np.matmul(
              observation_numpy, theta[k]
          ) + alpha * confidence_intervals.reshape([-1, 1])
          p_values.append(p_value)
  
      actions_numpy = np.argmax(
          np.stack(p_values, axis=-1), axis=-1
      ).reshape([batch_size])
      self.assertAllEqual(actions_.reshape([batch_size]), actions_numpy)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import itertools
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tf_agents.bandits.policies import linear_bandit_policy
  from tf_agents.bandits.specs import utils
  from tf_agents.policies import utils
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import time_step
  from tf_agents.utils import test_utils
label_desc: Use image node_id 18 for calling the LinearBanditPolicyTest obj's underlying member method code with example usage: obj.testComparisonWithNumpy(batch_size, use_decomposition, alpha) without return types