| 36 | |
| 37 | template <typename T> |
| 38 | static 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( \ |
no test coverage detected