Get shape of input tensor pointed by 'input_idx' in TensorShape format. If the input tensor is in OneDNN layout, then obtains TensorShape from MklShape.
| 727 | /// If the input tensor is in OneDNN layout, then obtains TensorShape from |
| 728 | /// MklShape. |
| 729 | inline TensorShape GetTfShape(OpKernelContext* context, size_t input_idx, |
| 730 | bool eager_mode = false) { |
| 731 | // Sanity check. |
| 732 | CHECK_NOTNULL(context); |
| 733 | CHECK_LT(input_idx, context->num_inputs()); |
| 734 | |
| 735 | MklDnnShape input_mkl_shape; |
| 736 | GetMklShape(context, input_idx, &input_mkl_shape, eager_mode); |
| 737 | if (input_mkl_shape.IsMklTensor() && !eager_mode) { |
| 738 | return input_mkl_shape.GetTfShape(); |
| 739 | } else { |
| 740 | const Tensor& t = MklGetInput(context, input_idx); |
| 741 | return t.shape(); |
| 742 | } |
| 743 | } |
| 744 | |
| 745 | // Allocate the second output tensor that will contain |
| 746 | // the OneDNN shape serialized |
no test coverage detected