class_docstr: Breaks a DatasetFeatureStatisticsList into shards keyed by partition index.
  
  Each partition index contains a random (but deterministic across workers)
  subset of features and cross features.
class_docstr_tok: ["Breaks","a","DatasetFeatureStatisticsList","into","shards","keyed","by","partition","index",".","Each","partition","index","contains","a","random","(","but","deterministic","across","workers",")","subset","of","features","and","cross","features","."]
docstr: Initializes KeyAndSplitByFeatureFn.
  
  Args:
    num_partitions: The number of partitions to divide features/cross-features
      into. Must be >= 1.
docstr_tok: ["Initializes","KeyAndSplitByFeatureFn",".","Args",":","num_partitions",":","The","number","of","partitions","to","divide","features\/cross-features","into",".","Must","be",">","=","1","."]
code: def __init__(self, num_partitions: int):
      """Initializes KeyAndSplitByFeatureFn.
  
      Args:
        num_partitions: The number of partitions to divide features/cross-features
          into. Must be >= 1.
      """
      if num_partitions < 1:
          raise ValueError("num_partitions must be >= 1.")
      if num_partitions != 1:
          self._hasher = ColumnHasher(num_partitions)
      else:
          self._hasher = None
  
file_path: data-validation/tensorflow_data_validation/utils/feature_partition_util.py
imports: import collections
  from typing import Any, FrozenSet, Iterable, Mapping, Tuple, Union
  import apache_beam
  import farmhash
  import pyarrow
  from tensorflow_data_validation import types
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 1 to create a new KeyAndSplitByFeatureFn object from inherited base classes: beam with example: obj = KeyAndSplitByFeatureFn(num_partitions)