26 #if defined(DATA_TYPE) && defined(NUM_REVERSE_DIMS) 28 #if NUM_REVERSE_DIMS > 4 29 #error("Reversing more than 4 dimensions is not currently supported") 74 const uint x_in = get_global_id(0);
75 const uint y_in = get_global_id(1);
76 const uint z_in = get_global_id(2) % depth;
77 const uint w_in = get_global_id(2) / depth;
79 const uint4 dims = (uint4)(0, 1, 2, 3);
80 int4 to_reverse = (int4)(0, 0, 0, 0);
81 #if NUM_REVERSE_DIMS == 1 82 const uint index = *((__global uint *)axis.
ptr);
83 to_reverse = (uint4)index == dims;
84 #elif NUM_REVERSE_DIMS == 2 85 const uint2 indices = vload2(0, (__global uint *)axis.
ptr);
86 to_reverse = ((uint4)indices.s0 == dims) || ((uint4)indices.s1 == dims);
87 #elif NUM_REVERSE_DIMS == 3 88 const uint2 indices01 = vload2(0, (__global uint *)axis.
ptr);
89 const uint index2 = *((__global uint *)axis.
ptr + 2);
90 to_reverse = ((uint4)indices01.s0 == dims) || ((uint4)indices01.s1 == dims) || ((uint4)index2 == dims);
92 const uint4 indices = vload4(0, (__global uint *)axis.
ptr);
93 to_reverse = ((uint4)indices.s0 == dims) || ((uint4)indices.s1 == dims) || ((uint4)indices.s2 == dims) || ((uint4)indices.s3 == dims);
95 const uint x_out = to_reverse.s0 ? width - x_in - 1 : x_in;
96 const uint y_out = to_reverse.s1 ? height - y_in - 1 : y_in;
97 const uint z_out = to_reverse.s2 ? depth - z_in - 1 : z_in;
98 const uint w_out = to_reverse.s3 ? batches - w_in - 1 : w_in;
102 #endif // defined(DATA_TYPE) && defined(NUM_REVERSE_DIMS) Structure to hold Vector information.
SimpleTensor< T > reverse(const SimpleTensor< T > &src, const SimpleTensor< uint32_t > &axis)
__global uchar * ptr
Pointer to the starting postion of the buffer.
SimpleTensor< float > src
Structure to hold 4D tensor information.
#define CONVERT_TO_TENSOR4D_STRUCT_NO_STEP(name, mod_size)
#define VECTOR_DECLARATION(name)
__global const uchar * tensor4D_offset(const Tensor4D *tensor, int x, int y, int z, int w)
Get the pointer position of a Tensor4D.
#define CONVERT_TO_TENSOR4D_STRUCT(name, mod_size)
__global uchar * ptr
Pointer to the starting postion of the buffer.
#define TENSOR4D_DECLARATION(name)
#define CONVERT_TO_VECTOR_STRUCT_NO_STEP(name)