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

Function ToScalar

tensorflow/core/kernels/reduction_ops_test.cc:27–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25// into a scalar.
26template <typename T>
27static Graph* ToScalar(const string& reduce, int num_x, int num_y) {
28 auto* g = new Graph(OpRegistry::Global());
29 Tensor data(DataTypeToEnum<T>::value, TensorShape({num_x, num_y}));
30 data.flat<T>().setRandom();
31 Tensor axes(DT_INT32, TensorShape({2}));
32 axes.flat<int32>()(0) = 0;
33 axes.flat<int32>()(1) = 1;
34 test::graph::Reduce(g, reduce, test::graph::Constant(g, data),
35 test::graph::Constant(g, axes));
36 return g;
37}
38
39static Graph* ColReduce(const string& reduce, int num_x, int num_y) {
40 auto* g = new Graph(OpRegistry::Global());

Callers 1

TEST_FFunction · 0.85

Calls 3

ConstantFunction · 0.70
TensorShapeClass · 0.50
ReduceFunction · 0.50

Tested by

no test coverage detected