code: def _is_per_replica(self, result, expected, klass=values.PerReplica):
      self.assertIsInstance(result, klass)
      for i, exp in enumerate(expected):
          self.assertEqual(exp, result.values[i])
  
imports: import collections
  import collections.abc
  from absl.testing import parameterized
  import wrapt
  from tensorflow.python.distribute import combinations
  from tensorflow.python.distribute import distribute_utils
  from tensorflow.python.distribute import strategy_combinations
  from tensorflow.python.distribute import values
  from tensorflow.python.eager import context
  from tensorflow.python.eager import test
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops import variable_v1
  from tensorflow.python.saved_model.model_utils import mode_keys
label_desc: Use image node_id 1 for calling the RegroupAndSelectDeviceTest obj's underlying member method code with example usage: obj._is_per_replica(result, expected, klass) without return types