MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / DynamicPartition

Function DynamicPartition

tensorflow/core/kernels/dynamic_partition_op_test.cc:313–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311
312template <typename T>
313static Graph* DynamicPartition(int num_partitions, int dim) {
314 Graph* g = new Graph(OpRegistry::Global());
315 // Always use a 128MB buffer.
316 const int kRows = ((128 << 20) / sizeof(T)) / dim;
317 Tensor data(DataTypeToEnum<T>::value, TensorShape({kRows, dim}));
318 data.flat<T>().setRandom();
319
320 random::PhiloxRandom philox(301, 17);
321 random::SimplePhilox rnd(&philox);
322 Tensor partitions(DT_INT32, TensorShape({kRows}));
323 for (int i = 0; i < kRows; i++) {
324 partitions.flat<int32>()(i) = rnd.Uniform(num_partitions);
325 }
326 DynamicPartitionNode(g, test::graph::Constant(g, data),
327 test::graph::Constant(g, partitions), num_partitions);
328 return g;
329}
330
331#define BM_DYNAMIC_PARTITION(DEVICE, T, num) \
332 static void BM_##DEVICE##_dynpart_##T##_##num(int iters, int dim) { \

Callers 2

DynamicPartitionGradFunction · 0.50
TEST_FFunction · 0.50

Calls 4

DynamicPartitionNodeFunction · 0.85
UniformMethod · 0.80
ConstantFunction · 0.70
TensorShapeClass · 0.50

Tested by

no test coverage detected