When the input tensor is in OneDNN layout and we are reshaping the tensor to a different shape than its actual shape, then we use DNNL reorder primitive to put tensor back in Tensorflow layout. But we can skip this reordering some times. This function checks for all such cases.
| 45 | // to put tensor back in Tensorflow layout. But we can skip this reordering |
| 46 | // some times. This function checks for all such cases. |
| 47 | bool SkipReorder(const MklDnnShape& mkl_shape_input, |
| 48 | const TensorShape& reshape_to) { |
| 49 | CHECK_EQ(mkl_shape_input.IsMklTensor(), true); |
| 50 | |
| 51 | // If Tensorflow's data format and the underlying format maintained by |
| 52 | // DNNL are equivalent (both are NHWC or both are NCHW), then we can |
| 53 | // safely return true. |
| 54 | // @todo: Future do not force skip reorder for all blocked format. Use |
| 55 | // blocking_desc_is_equal() for checking all the stride arrays in |
| 56 | // mkl-dnn/blob/master/src/common/type_helpers.hpp |
| 57 | auto input_mkl_md = mkl_shape_input.GetMklLayout(); |
| 58 | return SKIP_INPUT_REORDER(mkl_shape_input, input_mkl_md); |
| 59 | } |
| 60 | |
| 61 | public: |
| 62 | void Compute(OpKernelContext* context) override { |
nothing calls this directly
no test coverage detected