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

Function LRN

tensorflow/core/kernels/mkl_lrn_op_test.cc:38–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36
37template <typename T>
38static Graph* LRN(const string& kind, int DR, const TensorShape& in_shape,
39 float BIAS = 1.0f, float ALPHA = 0.1f,float BETA = 2.0f) {
40 Graph* g = new Graph(OpRegistry::Global());
41 DataType type = DataTypeToEnum<T>::v();
42
43 const bool isDefault = (kind == "Default");
44 string op_name = isDefault ? "LRN" : "_MklLRN";
45
46 Tensor in0(type, in_shape);
47 in0.flat<T>().setRandom();
48
49 Node* input_in0 = test::graph::Constant(g, in0);
50
51 Node* not_mkl_shape =
52 test::graph::Constant(g, GetMklMetaTensor(), "not_mkl");
53
54 auto nodeBuilder = NodeBuilder(g->NewName("n"), op_name)
55 .Input(input_in0)
56 .Attr("depth_radius", DR)
57 .Attr("bias", BIAS)
58 .Attr("alpha", ALPHA)
59 .Attr("beta", BETA);
60
61 isDefault ? nodeBuilder : nodeBuilder.Input(not_mkl_shape)
62 .Attr("_kernel", "MklLayoutDependentOp");
63
64 TF_CHECK_OK(nodeBuilder.Finalize(g, nullptr));
65
66 return g;
67}
68
69#define BM_LRN_Base(kind, DR, in_shape, name, T, DEVICE, NTH) \
70 static void BM_LRN##_##kind##_##DR##name##_##T##_##DEVICE##_##NTH( \

Callers 1

TEST_FFunction · 0.50

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