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

Function Identity

tensorflow/core/kernels/mkl_identity_op_test.cc:38–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36
37template <typename T>
38static Graph* Identity(const string& kind, const TensorShape& in_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 ? "Identity" : "_MklIdentity";
44
45 Tensor input(type, in_shape);
46 input.flat<T>().setRandom();
47
48 Node* not_mkl_shape =
49 test::graph::Constant(g, GetMklMetaTensor(), "not_mkl");
50
51 auto nodeBuilder = NodeBuilder(g->NewName("n"), op_name)
52 .Input(test::graph::Constant(g, input))
53 .Attr("T", type);
54
55 isDefault ? nodeBuilder : nodeBuilder.Input(not_mkl_shape)
56 .Attr("_kernel", "MklLayoutDependentOp");
57 TF_CHECK_OK(nodeBuilder.Finalize(g, nullptr));
58 return g;
59}
60
61#define BM_Identity_Base(kind, T, name, in_shape, DEVICE, NTH) \
62 static void BM_Identity##_##kind##_##T##name##_##DEVICE##_##NTH( \

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected