class_docstr: A custom non-streaming statistic.
  
  A PartitionedStatsFn is a custom statistic that cannot be computed in a
  streaming fashion. A user is required to implement the compute function.
  
  NonStreamingCustomStatsGenerator are initialized with
  a PartitionedStatsFn to estimate the PartitionedStatsFn over a large dataset.
  Examples in the dataset will be randomly assigned to a partition. Then the
  compute method will be called on each partition. If the examples in the
  partition contain invalid feature values, implementations of
  PartitionedStatsFn also have the option to "gracefully fail" without returning
  a statistic value for any invalid features.
class_docstr_tok: ["A","custom","non-streaming","statistic",".","A","PartitionedStatsFn","is","a","custom","statistic","that","can","not","be","computed","in","a","streaming","fashion",".","A","user","is","required","to","implement","the","compute","function",".","NonStreamingCustomStatsGenerator","are","initialized","with","a","PartitionedStatsFn","to","estimate","the","PartitionedStatsFn","over","a","large","dataset",".","Examples","in","the","dataset","will","be","randomly","assigned","to","a","partition",".","Then","the","compute","method","will","be","called","on","each","partition",".","If","the","examples","in","the","partition","contain","invalid","feature","values",",","implementations","of","PartitionedStatsFn","also","have","the","option","to","``","gracefully","fail","''","without","returning","a","statistic","value","for","any","invalid","features","."]
docstr: Optional PTransform to perform partition assignment.
  
  This may be overridden by subclasses to return a PTransform matching the
  signature of _default_partition_transform, which will be used if this method
  returns None.
  
  Args:
    num_partitions: The number of partitions to use. Overriding subclasses are
      free to use a different number of partitions.
  
  Returns:
    A PTransform.
docstr_tok: ["Optional","PTransform","to","perform","partition","assignment",".","This","may","be","overridden","by","subclasses","to","return","a","PTransform","matching","the","signature","of","_default_partition_transform",",","which","will","be","used","if","this","method","returns","None",".","Args",":","num_partitions",":","The","number","of","partitions","to","use",".","Overriding","subclasses","are","free","to","use","a","different","number","of","partitions",".","Returns",":","A","PTransform","."]
code: def partitioner(self, num_partitions: int) -> beam.PTransform:
      """Optional PTransform to perform partition assignment.
  
      This may be overridden by subclasses to return a PTransform matching the
      signature of _default_partition_transform, which will be used if this method
      returns None.
  
      Args:
        num_partitions: The number of partitions to use. Overriding subclasses are
          free to use a different number of partitions.
  
      Returns:
        A PTransform.
      """
      return _DefaultPartitionTransform(num_partitions)
  
imports: import collections
  import functools
  from typing import Dict, Iterable, Text, Tuple
  import apache_beam
  import numpy
  import pyarrow
  from tensorflow_data_validation import constants
  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 table_util
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 2 for calling the PartitionedStatsFn obj's underlying member method code with example usage: obj.partitioner(num_partitions) and returns: _DefaultPartitionTransform