DynamicPartition


tensorflow C++ API

tensorflow::ops::DynamicPartition

Partitionsdataintonum_partitionstensors using indices frompartitions.


Summary

For each index tuplejsof sizepartitions.ndim, the slicedata[js, ...]becomes part ofoutputs[partitions[js]]. The slices withpartitions[js] = iare placed inoutputs[i]in lexicographic order ofjs, and the first dimension ofoutputs[i]is the number of entries inpartitionsequal toi. In detail,

```python outputs[i].shape = [sum(partitions == i)] + data.shape[partitions.ndim:]

outputs[i] = pack([data[js, ...] for js if partitions[js] == i]) ```

data.shapemust start withpartitions.shape.

For example:

```python 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] ```

Seedynamic_stitchfor an example on how to merge partitions back.

Arguments:

  • scope: A Scope object
  • partitions: Any shape. Indices in the range[0, num_partitions).
  • num_partitions: The number of partitions to output.

Returns:

  • OutputList : The outputs tensor.

Constructor

  • DynamicPartition(const ::tensorflow::Scope & scope, ::tensorflow::Input data, ::tensorflow::Input partitions, int64 num_partitions).

Public attributes

  • tensorflow::Output outputs.

DynamicPartition block

Source link : https://github.com/EXPNUNI/enuSpace-Tensorflow/blob/master/enuSpaceTensorflow/tf_data_flow_ops.cpp

Argument:

  • Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
  • data : connect Input node or input data.
  • partitions : connect Input node or input int32 value.
  • num_partitions : connect Input node or input int64 value.

Return:

  • Output outputs: Output object of DynamicPartition class object.

Result:

  • std::vector(Tensor) product_result : Returned object of executed result by calling session.

Using Method

results matching ""

    No results matching ""