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

Function MklDnnDataFormatToTFDataFormat

tensorflow/core/util/mkl_util.h:1050–1062  ·  view source on GitHub ↗

Map OneDNN data format into TensorFlow data format @input: OneDNN data format @return: Tensorflow data format corresponding to OneDNN data format; Fails with an error if invalid data format.

Source from the content-addressed store, hash-verified

1048/// @return: Tensorflow data format corresponding to OneDNN data format;
1049/// Fails with an error if invalid data format.
1050inline TensorFormat MklDnnDataFormatToTFDataFormat(MklTensorFormat format) {
1051 if (format == MklTensorFormat::FORMAT_NHWC ||
1052 format == MklTensorFormat::FORMAT_NDHWC)
1053 return FORMAT_NHWC;
1054 if (format == MklTensorFormat::FORMAT_NCHW ||
1055 format == MklTensorFormat::FORMAT_NCDHW)
1056 return FORMAT_NCHW;
1057 TF_CHECK_OK(Status(error::Code::INVALID_ARGUMENT, "Unsupported data format"));
1058
1059 // Return to prevent compiler warnings, otherwise TF_CHECK_OK will ensure
1060 // that we don't come here.
1061 return FORMAT_NHWC;
1062}
1063
1064/// Map TensorShape object into memory::dims required by OneDNN
1065///

Callers 5

ComputeMethod · 0.85
ComputeMethod · 0.85
ComputeMethod · 0.85
ComputeMklSliceMethod · 0.85
SetTfDimOrderMethod · 0.85

Calls 1

StatusClass · 0.50

Tested by

no test coverage detected