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

Function DoTransposeImpl

tensorflow/core/kernels/transpose_functor.h:166–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164
165template <typename Device>
166Status DoTransposeImpl(const Device& d, const Tensor& in,
167 const gtl::ArraySlice<int32> perm, bool conjugate,
168 Tensor* out) {
169 CHECK_GE(in.dims(), 2);
170 CHECK_EQ(in.dims(), out->dims());
171 CHECK_EQ(in.dims(), perm.size());
172 CHECK_EQ(in.dtype(), out->dtype());
173 switch (in.dtype()) {
174 case DT_BOOL:
175 case DT_INT8:
176 case DT_QINT8:
177 case DT_QUINT8:
178 case DT_UINT8:
179 Transpose<Device, uint8>::run(d, in, perm, out);
180 break;
181
182 case DT_BFLOAT16:
183 case DT_HALF:
184 case DT_INT16:
185 case DT_QINT16:
186 case DT_QUINT16:
187 case DT_UINT16:
188 Transpose<Device, uint16>::run(d, in, perm, out);
189 break;
190
191 case DT_FLOAT:
192 case DT_INT32:
193 case DT_QINT32:
194 Transpose<Device, uint32>::run(d, in, perm, out);
195 break;
196
197 case DT_DOUBLE:
198 case DT_INT64:
199 Transpose<Device, uint64>::run(d, in, perm, out);
200 break;
201
202 case DT_COMPLEX64:
203 if (conjugate) {
204#if defined(__ANDROID__) and !defined(__clang__)
205 // Workaround for GCC compiler bug in Android toolchain.
206 return errors::Unimplemented(
207 "Conjugate transpose of complex64 not supported for GCC on "
208 "Android.");
209#else
210 Transpose<Device, complex64, /*conjugate=*/true>::run(d, in, perm, out);
211#endif
212 } else {
213 Transpose<Device, uint64>::run(d, in, perm, out);
214 }
215 break;
216
217 case DT_COMPLEX128:
218 if (conjugate) {
219 Transpose<Device, complex128, /*conjugate=*/true>::run(d, in, perm,
220 out);
221 } else {
222 Transpose<Device, complex128, /*conjugate=*/false>::run(d, in, perm,
223 out);

Callers 4

DoTransposeFunction · 0.85
DoConjugateTransposeFunction · 0.85
DoConjugateTransposeFunction · 0.85
DoMatrixTransposeImplFunction · 0.85

Calls 5

UnimplementedFunction · 0.85
runFunction · 0.50
dimsMethod · 0.45
sizeMethod · 0.45
dtypeMethod · 0.45

Tested by

no test coverage detected