class_docstr: Wrapper around features dict for accessing keys and values for slicing.
docstr: Get the values of the feature with the given key.
  
  Args:
    key: the key of the feature to get the values of
  
  Returns:
    The values of the feature.
  
  Raises:
    KeyError: If the feature was not present in the input example.
    ValueError: A dense feature was not a 1D array.
    ValueError: The feature had an unknown type.
code: def get(self, key: str) -> List[Union[int, bytes, float]]:
      """Get the values of the feature with the given key.
  
      Args:
        key: the key of the feature to get the values of
  
      Returns:
        The values of the feature.
  
      Raises:
        KeyError: If the feature was not present in the input example.
        ValueError: A dense feature was not a 1D array.
        ValueError: The feature had an unknown type.
      """
  
      def normalize_value(value):
          if value is None:
              return None
          if isinstance(value, dict) and "node" in value:
              # Backwards compatibility for features that were stored as FPL types
              # instead of native dicts.
              value = value["node"]
          if isinstance(
              value,
              (
                  types.SparseTensorValue,
                  types.RaggedTensorValue,
                  tf.compat.v1.SparseTensorValue,
                  tf.compat.v1.ragged.RaggedTensorValue,
              ),
          ):
              value = value.values
          if not isinstance(value, (np.ndarray, pa.Array, list)):
              raise ValueError(
                  "feature had unsupported type: key: %s, value: %s, type: %s"
                  % (key, value, type(value))
              )
          # Only np.array and multi-dimentional pa.array support flatten.
          if hasattr(value, "flatten"):
              value = value.flatten()
          return value
  
      values = None
      for d in self._features_dicts:
          value = normalize_value(d.get(key))
          if value is None:
              continue
          if values is None:
              values = value
          else:
              values = np.concatenate((values, value))
      if values is None and self._default_features_dict:
          values = normalize_value(self._default_features_dict.get(key))
      if values is None:
          raise KeyError("key %s not found" % key)
      return np.unique(values).tolist()
  
file_path: model-analysis/tensorflow_model_analysis/slicer/slice_accessor.py
imports: from typing import Iterable, List, Optional, Union
  import numpy
  import pyarrow
  import tensorflow
  from tensorflow_model_analysis.api import types
label_desc: Use image node_id 3 for calling the SliceAccessor obj's underlying member method code with example usage: obj.get(key) and returns: np, value, None