class_docstr: Computes the statistics for features of image format.
docstr: Return result of folding a batch of inputs into accumulator.
  
  Args:
    accumulator: The current accumulator.
    feature_path: The path of the feature.
    feature_array: An arrow array representing a batch of feature values
      which should be added to the accumulator.
  
  Returns:
    The accumulator after updating the statistics for the batch of inputs.
code: def add_input(
      self,
      accumulator: _PartialImageStats,
      feature_path: types.FeaturePath,
      feature_array: pa.Array,
  ) -> _PartialImageStats:
      """Return result of folding a batch of inputs into accumulator.
  
      Args:
        accumulator: The current accumulator.
        feature_path: The path of the feature.
        feature_array: An arrow array representing a batch of feature values
          which should be added to the accumulator.
  
      Returns:
        The accumulator after updating the statistics for the batch of inputs.
      """
      if accumulator.invalidate:
          return accumulator
      feature_type = stats_util.get_feature_type_from_arrow_type(
          feature_path, feature_array.type
      )
      # Ignore null array.
      if feature_type is None:
          return accumulator
      # If we see a different type, invalidate.
      if feature_type != statistics_pb2.FeatureNameStatistics.STRING:
          accumulator.invalidate = True
          return accumulator
  
      # Consider using memoryview to avoid copying after upgrading to
      # arrow 0.12. Note that this would involve modifying the subsequent logic
      # to iterate over the values in a loop.
      values = np.asarray(array_util.flatten_nested(feature_array)[0])
      accumulator.total_num_values += values.size
      image_formats = self._image_decoder.get_formats(values)
      valid_mask = ~pd.isnull(image_formats)
      valid_formats = image_formats[valid_mask]
      format_counts = np.unique(valid_formats, return_counts=True)
      for image_format, count in zip(*format_counts):
          accumulator.counter_by_format[image_format] += count
      unknown_count = image_formats.size - valid_formats.size
      if unknown_count > 0:
          accumulator.counter_by_format[""] += unknown_count
  
      if self._enable_size_stats:
          # Get image height and width.
          image_sizes = self._image_decoder.get_sizes(
              values[valid_mask]
          )
          if image_sizes.any():
              max_sizes = np.max(image_sizes, axis=0)
              # Update the max image height/width with all image values.
              accumulator.max_height = max(
                  accumulator.max_height, max_sizes[0]
              )
              accumulator.max_width = max(
                  accumulator.max_width, max_sizes[1]
              )
  
      return accumulator
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import collections
  from typing import Iterable, List, Optional, Text
  import numpy
  import pandas
  import pyarrow
  import six
  import tensorflow
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics.generators import stats_generator
  from tensorflow_data_validation.utils import stats_util
  from tfx_bsl.arrow import array_util
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 3 for calling the ImageStatsGenerator obj's underlying member method code with example usage: obj.add_input(accumulator, feature_path, feature_array) and returns: accumulator, accumulator, accumulator, accumulator