class_docstr: Size estimator.
docstr: Update current size based on the input value.
docstr_tok: ["Update","current","size","based","on","the","input","value","."]
code: def update(self, value: Any):
      """Update current size based on the input value."""
      # In TFMA workloads, we often fanout the input extracts across multiple
      # slices and then combine the inputs per slice. This leads to
      # inputs having high refcounts which can trick the combiner tables into
      # thinking they are full, when that's not really the case (for more details
      # see b/111353165). As such, we try to account for estimated size of an
      # input by "amortizing" its estimated size across its refcounts but we also
      # assume only part of the refcount is due to duplication we want to account
      # for (which prevents us from drammatically underestimating the common case
      # of combining where there are no fanouts).
      # TODO(b/162743769): Possibly adjust the value of discounted_references
      # based on telemetry.
      discounted_references = 3
      unamortized_size = self._size_fn(value)
      refcount = sys.getrefcount(value)
      amortized_size = int(
          unamortized_size / max(1, refcount - discounted_references)
      )
      self._curr_size += amortized_size
      self._unamortized_size.update(unamortized_size)
      self._refcount.update(refcount)
      self._amortized_size.update(amortized_size)
  
file_path: model-analysis/tensorflow_model_analysis/utils/size_estimator.py
imports: import sys
  from typing import Any, Callable
  import apache_beam
  from tensorflow_model_analysis import constants
label_desc: Use image node_id 3 for calling the SizeEstimator obj's underlying member method code with example usage: obj.update(value) without return types