Skip to content

Commit ca39124

Browse files
committed
data_flow.dynamic_partition
1 parent 2b37b63 commit ca39124

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/TensorFlowNET.Core/APIs/tf.data_flow.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,19 @@ public partial class tensorflow
2727
/// <param name="data"></param>
2828
/// <param name="name"></param>
2929
/// <returns></returns>
30-
public static Tensor dynamic_stitch(Tensor[] indices, Tensor[] data, string name = null)
30+
public Tensor dynamic_stitch(Tensor[] indices, Tensor[] data, string name = null)
3131
=> gen_data_flow_ops.dynamic_stitch(indices, data, name: name);
32+
33+
/// <summary>
34+
/// Partitions `data` into `num_partitions` tensors using indices from `partitions`.
35+
/// </summary>
36+
/// <param name="data"></param>
37+
/// <param name="partitions"></param>
38+
/// <param name="num_partitions">The number of partitions to output.</param>
39+
/// <param name="name"></param>
40+
/// <returns></returns>
41+
public Tensor[] dynamic_partition(Tensor data, Tensor partitions, int num_partitions,
42+
string name = null)
43+
=> gen_data_flow_ops.dynamic_partition(data, partitions, num_partitions, name: name);
3244
}
3345
}

src/TensorFlowNET.Core/Operations/gen_data_flow_ops.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ public static Tensor dynamic_stitch(Tensor[] indices, Tensor[] data, string name
2727
return _op.output;
2828
}
2929

30+
public static Tensor[] dynamic_partition(Tensor data, Tensor partitions, int num_partitions,
31+
string name = null)
32+
{
33+
var _op = _op_def_lib._apply_op_helper("DynamicPartition", name, new
34+
{
35+
data,
36+
partitions,
37+
num_partitions
38+
});
39+
40+
return _op.outputs;
41+
}
42+
3043
public static (Tensor, Tensor) tensor_array_v3<T>(T size, TF_DataType dtype = TF_DataType.DtInvalid,
3144
TensorShape element_shape = null, bool dynamic_size = false, bool clear_after_read = true,
3245
bool identical_element_shapes = false, string tensor_array_name = "", string name = null)

0 commit comments

Comments
 (0)