def num_discarded(self):
    """Get the number of values discarded due to exceeding both limits."""
    if not self._data:
      return 0
    n = 0
    while n < len(self._data):
      if not isinstance(self._data[n], _TensorValueDiscarded):
        break
      n += 1
    return n