13 #include <Eigen/CXX11/Tensor> 18 template <
int DataLayout>
31 reversed_tensor = tensor.
reverse(dim_rev);
38 for (
int i = 0;
i < 2; ++
i) {
39 for (
int j = 0;
j < 3; ++
j) {
40 for (
int k = 0; k < 5; ++k) {
41 for (
int l = 0;
l < 7; ++
l) {
53 reversed_tensor = tensor.
reverse(dim_rev);
61 for (
int i = 0;
i < 2; ++
i) {
62 for (
int j = 0;
j < 3; ++
j) {
63 for (
int k = 0; k < 5; ++k) {
64 for (
int l = 0;
l < 7; ++
l) {
76 reversed_tensor = tensor.
reverse(dim_rev);
84 for (
int i = 0;
i < 2; ++
i) {
85 for (
int j = 0;
j < 3; ++
j) {
86 for (
int k = 0; k < 5; ++k) {
87 for (
int l = 0;
l < 7; ++
l) {
96 template <
int DataLayout>
110 expected.
reverse(dim_rev) = tensor;
112 expected = tensor.
reverse(dim_rev);
118 src_slice_dim[0] = 2;
119 src_slice_dim[1] = 3;
120 src_slice_dim[2] = 1;
121 src_slice_dim[3] = 7;
123 src_slice_start[0] = 0;
124 src_slice_start[1] = 0;
125 src_slice_start[2] = 0;
126 src_slice_start[3] = 0;
130 for (
int i = 0;
i < 5; ++
i) {
132 result.
slice(dst_slice_start, dst_slice_dim).reverse(dim_rev) =
133 tensor.
slice(src_slice_start, src_slice_dim);
135 result.
slice(dst_slice_start, dst_slice_dim) =
136 tensor.
slice(src_slice_start, src_slice_dim).reverse(dim_rev);
138 src_slice_start[2] += 1;
139 dst_slice_start[2] += 1;
149 for (
int k = 0; k < expected.
dimension(2); ++k) {
157 dst_slice_start[2] = 0;
159 for (
int i = 0;
i < 5; ++
i) {
161 result.
slice(dst_slice_start, dst_slice_dim).reverse(dim_rev) =
162 tensor.
slice(dst_slice_start, dst_slice_dim);
164 result.
slice(dst_slice_start, dst_slice_dim) =
165 tensor.
reverse(dim_rev).slice(dst_slice_start, dst_slice_dim);
167 dst_slice_start[2] += 1;
172 for (
int k = 0; k < expected.
dimension(2); ++k) {
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorSlicingOp< const StartIndices, const Sizes, const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > slice(const StartIndices &startIndices, const Sizes &sizes) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index dimension(std::size_t n) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setRandom()
static void test_expr_reverse(bool LValue)
static const Line3 l(Rot3(), 1, 1)
#define VERIFY_IS_EQUAL(a, b)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorReverseOp< const ReverseDimensions, const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > reverse(const ReverseDimensions &rev) const
static void test_simple_reverse()
#define CALL_SUBTEST(FUNC)
void test_cxx11_tensor_reverse()