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

Function MklDnnDimsToTFShape

tensorflow/core/util/mkl_util.h:1162–1171  ·  view source on GitHub ↗

Map OneDNN memory::dims object into TensorShape object. This function will simply map input shape in OneDNN memory::dims format in Tensorflow's TensorShape object by preserving dimension order. @input OneDNN memory::dims object @output TensorShape corresponding to memory::dims

Source from the content-addressed store, hash-verified

1160/// @input OneDNN memory::dims object
1161/// @output TensorShape corresponding to memory::dims
1162inline TensorShape MklDnnDimsToTFShape(const memory::dims& dims) {
1163 std::vector<int32> shape(dims.size(), -1);
1164 for (int d = 0; d < dims.size(); d++) {
1165 shape[d] = dims[d];
1166 }
1167
1168 TensorShape ret;
1169 CHECK_EQ(TensorShapeUtils::MakeShape(shape, &ret).ok(), true);
1170 return ret;
1171}
1172
1173/// Function to calculate strides given tensor shape in Tensorflow order
1174/// E.g., if dims_tf_order is {1, 2, 3, 4}, then as per Tensorflow convention,

Callers 8

ComputeMethod · 0.85
ComputeMethod · 0.85
ComputeMethod · 0.85
ComputeMethod · 0.85
ComputeMklSliceMethod · 0.85
AllocateOutputTensorMethod · 0.85
ComputeMethod · 0.85

Calls 3

MakeShapeFunction · 0.85
sizeMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected