code: def testUpdate(self, dtype):
      # Construct and evaluate normalized tensor. Should update mean &
      #   variance.
      spec = tensor_spec.TensorSpec([3], dtype, "obs")
      dict_tensor_normalizer = (
          tensor_normalizer.StreamingTensorNormalizer(
              tensor_spec={"a": spec, "b": spec}
          )
      )
      self.evaluate(tf.compat.v1.global_variables_initializer())
  
      np_array = np.array(
          [[1.3, 4.2, 7.5], [8.3, 2.2, 9.5], [3.3, 5.2, 6.5]],
          dtype.as_numpy_dtype,
      )
      tensors = {
          "a": tf.constant(np_array, dtype=dtype),
          "b": tf.constant(np_array, dtype=dtype),
      }
  
      def _compare(data):
          n = data.shape[0]
          expected_avg = data.mean(axis=0)
          expected_var = data.var(axis=0)
          expected_m2 = expected_var * n
          expected_count = np.array([n] * 3)
  
          new_count, new_avg, new_m2, _ = self.evaluate(
              dict_tensor_normalizer.variables
          )
  
          tf.nest.map_structure(
              lambda v: self.assertAllClose(v, expected_count),
              new_count,
          )
          tf.nest.map_structure(
              lambda v: self.assertAllClose(v, expected_avg), new_avg
          )
          tf.nest.map_structure(
              lambda v: self.assertAllClose(v, expected_m2), new_m2
          )
  
      update_norm_vars = dict_tensor_normalizer.update(tensors)
      self.evaluate(update_norm_vars)
      _compare(data=np_array)
  
      update_norm_vars = dict_tensor_normalizer.update(
          tf.nest.map_structure(lambda t: t + 1.0, tensors)
      )
      self.evaluate(update_norm_vars)
      _compare(data=np.concatenate((np_array, np_array + 1.0), axis=0))
  
      update_norm_vars = dict_tensor_normalizer.update(
          tf.nest.map_structure(lambda t: t - 1.0, tensors)
      )
      self.evaluate(update_norm_vars)
      _compare(
          data=np.concatenate(
              (np_array, np_array + 1.0, np_array - 1.0), axis=0
          )
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tf_agents.specs import tensor_spec
  from tf_agents.utils import tensor_normalizer
label_desc: Use image node_id 3 for calling the StreamingTensorNormalizerTest obj's underlying member method code with example usage: obj.testUpdate(dtype) without return types