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

Method DoTranspose

tensorflow/core/kernels/mkl_transpose_op.cc:108–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106} // namespace
107
108Status MklTransposeCpuOp::DoTranspose(OpKernelContext* ctx, const Tensor& in,
109 gtl::ArraySlice<int32> perm,
110 Tensor* out) {
111 // OneDNN has limit on the maximum number of dimensions in a tensor.
112 // Fallback to Eigen for not supported cases.
113 if (in.dims() <= TENSOR_MAX_DIMS) {
114 switch (in.dtype()) {
115 case DT_FLOAT:
116 return MKLTransposeND<float>(ctx, in, out, perm);
117 break;
118 case DT_BFLOAT16:
119 return MKLTransposeND<bfloat16>(ctx, in, out, perm);
120 break;
121 // TODO(nhasabni): support other types such as INT8.
122 default:
123 break;
124 }
125 }
126
127 // Fallback to eigen if transpose parameters not supported by OneDNN
128 typedef Eigen::ThreadPoolDevice CPUDevice;
129 return ::tensorflow::DoTranspose(ctx->eigen_device<CPUDevice>(), in, perm,
130 out);
131}
132
133Status MklConjugateTransposeCpuOp::DoTranspose(OpKernelContext* ctx,
134 const Tensor& in,

Callers

nothing calls this directly

Calls 4

DoTransposeFunction · 0.85
DoConjugateTransposeFunction · 0.70
dimsMethod · 0.45
dtypeMethod · 0.45

Tested by

no test coverage detected