class_docstr: Encapsulates tensor normalization and owns normalization variables.
  
  Example usage:
  
  ```
  tensor_normalizer = StreamingTensorNormalizer(
      tf.TensorSpec([], tf.float32))
  observation_list = [list of float32 scalars or batches]
  normalized_list = []
  
  for o in observation_list:
    normalized_list.append(tensor_normalizer.normalize(o))
    tensor_normalizer.update(o)
  ```
  
  For float64 inputs do:
  ```
  tensor_normalizer = StreamingTensorNormalizer(
      tf.TensorSpec([], tf.float64), dtype=tf.float64)
  observation_list = [list of float64 scalars or batches]
  
  for o in observation_list:
    normalized_list.append(tensor_normalizer.normalize(o))
    tensor_normalizer.update(o)
docstr: Applies normalization to tensor.
  
  Args:
    tensor: Tensor to normalize.
    clip_value: Clips normalized observations between +/- this value if
      clip_value > 0, otherwise does not apply clipping.
    center_mean: If true, subtracts off mean from normalized tensor.
    variance_epsilon: Epsilon to avoid division by zero in normalization.
  
  Returns:
    normalized_tensor: Tensor after applying normalization.
docstr_tok: ["Applies","normalization","to","tensor",".","Args",":","tensor",":","Tensor","to","normalize",".","clip_value",":","Clips","normalized","observations","between","+\/-","this","value","if","clip_value",">","0",",","otherwise","does","not","apply","clipping",".","center_mean",":","If","true",",","subtracts","off","mean","from","normalized","tensor",".","variance_epsilon",":","Epsilon","to","avoid","division","by","zero","in","normalization",".","Returns",":","normalized_tensor",":","Tensor","after","applying","normalization","."]
code: def normalize(
      self,
      tensor,
      clip_value=5.0,
      center_mean=True,
      variance_epsilon=1e-3,
  ):
      """Applies normalization to tensor.
  
      Args:
        tensor: Tensor to normalize.
        clip_value: Clips normalized observations between +/- this value if
          clip_value > 0, otherwise does not apply clipping.
        center_mean: If true, subtracts off mean from normalized tensor.
        variance_epsilon: Epsilon to avoid division by zero in normalization.
  
      Returns:
        normalized_tensor: Tensor after applying normalization.
      """
      nest_utils.assert_matching_dtypes_and_inner_shapes(
          tensor,
          self._tensor_spec,
          caller=self,
          tensors_name="tensors",
          specs_name="tensor_spec",
      )
      tensor = [
          tf.cast(t, self.map_dtype(t.dtype))
          for t in tf.nest.flatten(tensor)
      ]
  
      with tf.name_scope(self._scope + "/normalize"):
          mean_estimate, var_estimate = self._get_mean_var_estimates()
          mean = (
              mean_estimate
              if center_mean
              else tf.nest.map_structure(tf.zeros_like, mean_estimate)
          )
  
          def _normalize_single_tensor(
              single_tensor, single_mean, single_var
          ):
              return tf.nn.batch_normalization(
                  single_tensor,
                  single_mean,
                  single_var,
                  offset=None,
                  scale=None,
                  variance_epsilon=variance_epsilon,
                  name="normalized_tensor",
              )
  
          normalized_tensor = nest_utils.map_structure_up_to(
              self._flat_variable_spec,
              _normalize_single_tensor,
              tensor,
              mean,
              var_estimate,
              check_types=False,
          )
  
          if clip_value > 0:
  
              def _clip(t):
                  return tf.clip_by_value(
                      t,
                      -clip_value,
                      clip_value,
                      name="clipped_normalized_tensor",
                  )
  
              normalized_tensor = tf.nest.map_structure(
                  _clip, normalized_tensor
              )
  
      normalized_tensor = tf.nest.pack_sequence_as(
          self._tensor_spec, normalized_tensor
      )
      normalized_tensor = tf.nest.map_structure(
          lambda t, spec: tf.cast(t, spec.dtype),
          normalized_tensor,
          self._tensor_spec,
      )
      return normalized_tensor
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  from typing import Tuple
  import six
  import tensorflow
  from tf_agents.specs import tensor_spec
  from tf_agents.typing import types
  from tf_agents.utils import common
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 9 for calling the TensorNormalizer obj's underlying member method code with example usage: obj.normalize(tensor, clip_value, center_mean, variance_epsilon) and returns: normalized_tensor, tf, tf