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

Function TransposeUsingEigen

tensorflow/core/kernels/transpose_functor.h:147–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145// Uses Eigen to transpose.
146template <typename Device, typename T, int NDIMS>
147void TransposeUsingEigen(const Device& d, const Tensor& in,
148 const gtl::ArraySlice<int32> perm, bool conjugate,
149 Tensor* out) {
150 Eigen::array<int, NDIMS> p;
151 for (int i = 0; i < NDIMS; ++i) p[i] = perm[i];
152 auto x = typename TTypes<T, NDIMS>::ConstTensor(
153 reinterpret_cast<const T*>(in.tensor_data().data()),
154 in.shape().AsEigenDSizes<NDIMS>());
155 auto y = typename TTypes<T, NDIMS>::Tensor(
156 reinterpret_cast<T*>(const_cast<char*>(out->tensor_data().data())),
157 out->shape().AsEigenDSizes<NDIMS>());
158 if (conjugate) {
159 y.device(d) = x.conjugate().shuffle(p);
160 } else {
161 y.device(d) = x.shuffle(p);
162 }
163}
164
165template <typename Device>
166Status DoTransposeImpl(const Device& d, const Tensor& in,

Callers

nothing calls this directly

Calls 7

tensor_dataMethod · 0.80
conjugateMethod · 0.80
TensorClass · 0.70
dataMethod · 0.45
shapeMethod · 0.45
deviceMethod · 0.45
shuffleMethod · 0.45

Tested by

no test coverage detected