Skip to content
Permalink
Browse files Browse the repository at this point in the history
Merge pull request #46973 from yongtang:46891-tf.transpose-conjugate
PiperOrigin-RevId: 367235888
Change-Id: I1bfe9fcae65cf68100ec55a60d680c536c0e70a7
  • Loading branch information
tensorflower-gardener committed Apr 7, 2021
2 parents 4d1c9c6 + 6cbc31d commit 1dc6a7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions tensorflow/core/kernels/transpose_functor.h
Expand Up @@ -19,6 +19,7 @@ limitations under the License.
#include <numeric>
#include <string>
#include <vector>

#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/framework/tensor_types.h"
#include "tensorflow/core/platform/logging.h"
Expand Down Expand Up @@ -166,7 +167,6 @@ template <typename Device>
Status DoTransposeImpl(const Device& d, const Tensor& in,
const gtl::ArraySlice<int32> perm, bool conjugate,
Tensor* out) {
CHECK_GE(in.dims(), 2);
CHECK_EQ(in.dims(), out->dims());
CHECK_EQ(in.dims(), perm.size());
CHECK_EQ(in.dtype(), out->dtype());
Expand Down Expand Up @@ -247,7 +247,6 @@ inline Status DoMatrixTransposeImpl(const Device& device, const Tensor& in,
return DoTransposeImpl(device, in, perm, conjugate, out);
}


} // namespace internal
} // namespace tensorflow

Expand Down
4 changes: 4 additions & 0 deletions tensorflow/python/kernel_tests/transpose_op_test.py
Expand Up @@ -379,6 +379,8 @@ def testDouble(self):
np.arange(0, 16).reshape([1, 2, 1, 2, 1, 2, 1, 2]).astype(np.float64))

def testComplex64(self):
self._testBoth(np.array(np.complex(1, 2)).astype(np.complex64))
self._testBoth(np.complex(1, 2) * np.arange(0, 21).astype(np.complex64))
self._testBoth(
np.complex(1, 2) *
np.arange(0, 21).reshape([3, 7]).astype(np.complex64))
Expand All @@ -390,6 +392,8 @@ def testComplex64(self):
np.arange(0, 1260).reshape([2, 3, 5, 7, 2, 3]).astype(np.complex64))

def testComplex128(self):
self._testBoth(np.array(np.complex(1, 2)).astype(np.complex128))
self._testBoth(np.complex(1, 2) * np.arange(0, 21).astype(np.complex128))
self._testBoth(
np.complex(1, 2) *
np.arange(0, 21).reshape([3, 7]).astype(np.complex128))
Expand Down

0 comments on commit 1dc6a7c

Please sign in to comment.