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

Function AddN

tensorflow/core/kernels/mkl_aggregate_ops_test.cc:38–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36
37template <typename T>
38static Graph* AddN(const string& kind, int num_inputs, const TensorShape& shape) {
39 Graph* g = new Graph(OpRegistry::Global());
40 DataType type = DataTypeToEnum<T>::v();
41
42 const bool isDefault = (kind == "Default");
43 string op_name = isDefault ? "AddN" : "_MklAddN";
44 std::vector<NodeBuilder::NodeOut> inputs;
45 std::vector<NodeBuilder::NodeOut> inputs_not_mkl;
46 inputs.reserve(num_inputs);
47 inputs_not_mkl.reserve(num_inputs);
48
49 for (int i = 0; i < num_inputs; ++i) {
50 Tensor in(type, shape);
51 in.flat<T>().setRandom();
52 inputs.push_back(test::graph::Constant(g, in));
53 inputs_not_mkl.push_back(test::graph::Constant(g, GetMklMetaTensor(), "not_mkl"));
54 }
55
56 auto nodeBuilder = NodeBuilder(g->NewName("n"), op_name)
57 .Input(inputs)
58 .Attr("T", type);
59 isDefault ? nodeBuilder : nodeBuilder.Input(inputs_not_mkl)
60 .Attr("_kernel", "MklLayoutDependentOp");
61 TF_CHECK_OK(nodeBuilder.Finalize(g, nullptr));
62 return g;
63}
64
65#define BM_AddN_Base(kind, T, name, nums, tf_shape, DEVICE, NTH) \
66 static void BM_AddN##_##kind##_##T##_##name##_##DEVICE##_##NTH( \

Callers 15

RunConv2DUnfusedMethod · 0.70
TEST_FFunction · 0.50
TESTFunction · 0.50
GetAddNNodeDefFunction · 0.50
TESTFunction · 0.50
TEST_FFunction · 0.50
TEST_FFunction · 0.50
CreateSimpleAddNFunction · 0.50
TEST_FFunction · 0.50
TEST_FFunction · 0.50
TEST_FFunction · 0.50

Calls 9

GetMklMetaTensorFunction · 0.85
ConstantFunction · 0.70
NodeBuilderClass · 0.50
reserveMethod · 0.45
push_backMethod · 0.45
AttrMethod · 0.45
InputMethod · 0.45
NewNameMethod · 0.45
FinalizeMethod · 0.45

Tested by

no test coverage detected