DynamicPartition

public final class DynamicPartition

Partitions `data` into `num_partitions` tensors using indices from `partitions`.

For each index tuple `js` of size `partitions.ndim`, the slice `data[js, ...]` becomes part of `outputs[partitions[js]]`. The slices with `partitions[js] = i` are placed in `outputs[i]` in lexicographic order of `js`, and the first dimension of `outputs[i]` is the number of entries in `partitions` equal to `i`. In detail,

outputs[i].shape = [sum(partitions == i)] + data.shape[partitions.ndim:]
 
     outputs[i] = pack([data[js, ...] for js if partitions[js] == i])
 
`data.shape` must start with `partitions.shape`.

For example:

# Scalar partitions.
     partitions = 1
     num_partitions = 2
     data = [10, 20]
     outputs[0] = []  # Empty with shape [0, 2]
     outputs[1] = [[10, 20]]
 
     # Vector partitions.
     partitions = [0, 0, 1, 1, 0]
     num_partitions = 2
     data = [10, 20, 30, 40, 50]
     outputs[0] = [10, 20, 50]
     outputs[1] = [30, 40]
 
See `dynamic_stitch` for an example on how to merge partitions back.

Constants

String OP_NAME The name of this op, as known by TensorFlow core engine

Public Methods

static <T extends TType> DynamicPartition<T>
create(Scope scope, Operand<T> data, Operand<TInt32> partitions, Long numPartitions)
Factory method to create a class wrapping a new DynamicPartition operation.
Iterator<Operand<T>>
List<Output<T>>

Inherited Methods

Constants

public static final String OP_NAME

The name of this op, as known by TensorFlow core engine

Constant Value: "DynamicPartition"

Public Methods

public static DynamicPartition<T> create (Scope scope, Operand<T> data, Operand<TInt32> partitions, Long numPartitions)

Factory method to create a class wrapping a new DynamicPartition operation.

Parameters
scope current scope
partitions Any shape. Indices in the range `[0, num_partitions)`.
numPartitions The number of partitions to output.
Returns
  • a new instance of DynamicPartition

public Iterator<Operand<T>> iterator ()

public List<Output<T>> outputs ()