MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetTfShape

Function GetTfShape

tensorflow/core/util/mkl_util.h:729–743  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

727/// If the input tensor is in OneDNN layout, then obtains TensorShape from
728/// MklShape.
729inline 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

Callers 7

ComputeMethod · 0.85
MakeInputTfShapeMethod · 0.85
ComputeMethod · 0.85
ComputeMethod · 0.85
MakeFilterTfShapeMethod · 0.85

Calls 5

GetMklShapeFunction · 0.85
IsMklTensorMethod · 0.80
GetTfShapeMethod · 0.80
num_inputsMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected