class_docstr: Keeps track of a running mean for seen states
code: def __call__(
      self, x: TensorStructType, update: bool = True
  ) -> TensorStructType:
      if self.no_preprocessor:
          x = tree.map_structure(lambda x_: np.asarray(x_), x)
      else:
          x = np.asarray(x)
  
      def _helper(x, rs, buffer, shape):
          # Discrete|MultiDiscrete spaces -> No normalization.
          if shape is None:
              return x
  
          # Keep dtype as is througout this filter.
          orig_dtype = x.dtype
  
          if update:
              if len(x.shape) == len(rs.shape) + 1:
                  # The vectorized case.
                  for i in range(x.shape[0]):
                      rs.push(x[i])
                      buffer.push(x[i])
              else:
                  # The unvectorized case.
                  rs.push(x)
                  buffer.push(x)
          if self.demean:
              x = x - rs.mean
          if self.destd:
              x = x / (rs.std + SMALL_NUMBER)
          if self.clip:
              x = np.clip(x, -self.clip, self.clip)
          return x.astype(orig_dtype)
  
      if self.no_preprocessor:
          return tree.map_structure_up_to(
              x, _helper, x, self.running_stats, self.buffer, self.shape
          )
      else:
          return _helper(x, self.running_stats, self.buffer, self.shape)
  
imports: import logging
  import threading
  import numpy
  import tree
  from ray.rllib.utils.annotations import DeveloperAPI
  from ray.rllib.utils.deprecation import Deprecated
  from ray.rllib.utils.numpy import SMALL_NUMBER
  from ray.rllib.utils.typing import TensorStructType
  from ray.rllib.utils.serialization import _serialize_ndarray, _deserialize_ndarray
  from ray.rllib.utils.deprecation import deprecation_warning
label_desc: Use image node_id 7 for calling the MeanStdFilter obj's underlying member method code with example usage: obj.__call__(x, update) and returns: x, tree, _helper, x