| 483 | |
| 484 | private: |
| 485 | void AllocateOutputTensor(OpKernelContext* context, |
| 486 | const MklDnnShape& input_mkl_shape, |
| 487 | MEMORY_PRIMITIVE_DESC* output_pd, |
| 488 | const memory::dims& output_dims, |
| 489 | Tensor** output_tensor, |
| 490 | MklDnnShape* output_mkl_shape) { |
| 491 | DCHECK(output_tensor); |
| 492 | DCHECK(output_mkl_shape); |
| 493 | |
| 494 | TensorShape output_tf_shape; |
| 495 | |
| 496 | if (input_mkl_shape.IsMklTensor()) { |
| 497 | // Since input tensor is in OneDNN layout, output tensor will be in OneDNN |
| 498 | // layout. |
| 499 | |
| 500 | // Allocate shape of OneDNN tensor. |
| 501 | output_mkl_shape->SetMklTensor(true); |
| 502 | output_mkl_shape->SetMklLayout(output_pd); |
| 503 | output_mkl_shape->SetElemType(MklDnnType<T>()); |
| 504 | output_mkl_shape->SetTfLayout(input_mkl_shape.GetDimension(), output_dims, |
| 505 | input_mkl_shape.GetTfDataFormat()); |
| 506 | |
| 507 | output_tf_shape.AddDim(output_pd->get_size() / sizeof(T)); |
| 508 | } else { |
| 509 | // If input is not in OneDNN layout, then output won't be in OneDNN layout. |
| 510 | output_mkl_shape->SetMklTensor(false); |
| 511 | output_tf_shape = MklDnnDimsToTFShape(output_dims); |
| 512 | } |
| 513 | |
| 514 | AllocateOutputSetMklShape(context, 0, output_tensor, output_tf_shape, |
| 515 | *output_mkl_shape); |
| 516 | } |
| 517 | }; |
| 518 | |
| 519 | // OneDNN Slice registration |
nothing calls this directly
no test coverage detected