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