29 IndexType sizeDim1 = 2;
30 IndexType sizeDim2 = 3;
31 IndexType sizeDim3 = 5;
32 IndexType sizeDim4 = 7;
36 patchTensorRange = {{1, 1, 1, 1, sizeDim1 * sizeDim2 * sizeDim3 * sizeDim4}};
38 patchTensorRange = {{sizeDim1 * sizeDim2 * sizeDim3 * sizeDim4, 1, 1, 1, 1}};
52 const size_t tensorBuffSize = tensor.size() *
sizeof(DataType);
53 size_t patchTensorBuffSize = no_patch.size() *
sizeof(DataType);
54 DataType* gpu_data_tensor =
static_cast<DataType*
>(sycl_device.allocate(tensorBuffSize));
55 DataType* gpu_data_no_patch =
static_cast<DataType*
>(sycl_device.allocate(patchTensorBuffSize));
60 sycl_device.memcpyHostToDevice(gpu_data_tensor, tensor.data(), tensorBuffSize);
61 gpu_no_patch.device(sycl_device) = gpu_tensor.extract_patches(patch_dims);
62 sycl_device.memcpyDeviceToHost(no_patch.data(), gpu_data_no_patch, patchTensorBuffSize);
78 for (
int i = 0;
i < tensor.size(); ++
i) {
88 patchTensorRange = {{sizeDim1, sizeDim2, sizeDim3, sizeDim4, 1}};
90 patchTensorRange = {{1, sizeDim1, sizeDim2, sizeDim3, sizeDim4}};
93 patchTensorBuffSize = single_patch.size() *
sizeof(DataType);
94 DataType* gpu_data_single_patch =
static_cast<DataType*
>(sycl_device.allocate(patchTensorBuffSize));
97 gpu_single_patch.device(sycl_device) = gpu_tensor.extract_patches(patch_dims);
98 sycl_device.memcpyDeviceToHost(single_patch.data(), gpu_data_single_patch, patchTensorBuffSize);
114 for (
int i = 0;
i < tensor.size(); ++
i) {
123 patchTensorRange = {{1, 2, 2, 1, 2 * 2 * 4 * 7}};
125 patchTensorRange = {{2 * 2 * 4 * 7, 1, 2, 2, 1}};
128 patchTensorBuffSize = twod_patch.size() *
sizeof(DataType);
129 DataType* gpu_data_twod_patch =
static_cast<DataType*
>(sycl_device.allocate(patchTensorBuffSize));
132 gpu_twod_patch.device(sycl_device) = gpu_tensor.extract_patches(patch_dims);
133 sycl_device.memcpyDeviceToHost(twod_patch.data(), gpu_data_twod_patch, patchTensorBuffSize);
149 for (
int i = 0;
i < 2; ++
i) {
150 for (
int j = 0;
j < 2; ++
j) {
151 for (
int k = 0;
k < 4; ++
k) {
152 for (
int l = 0; l < 7; ++l) {
155 patch_loc =
i + 2 * (
j + 2 * (
k + 4 * l));
157 patch_loc = l + 7 * (
k + 4 * (
j + 2 *
i));
159 for (
int x = 0;
x < 2; ++
x) {
160 for (
int y = 0;
y < 2; ++
y) {
179 patchTensorRange = {{1, 2, 3, 5, 2 * 2 * 3 * 3}};
181 patchTensorRange = {{2 * 2 * 3 * 3, 1, 2, 3, 5}};
184 patchTensorBuffSize = threed_patch.size() *
sizeof(DataType);
185 DataType* gpu_data_threed_patch =
static_cast<DataType*
>(sycl_device.allocate(patchTensorBuffSize));
188 gpu_threed_patch.device(sycl_device) = gpu_tensor.extract_patches(patch_dims);
189 sycl_device.memcpyDeviceToHost(threed_patch.data(), gpu_data_threed_patch, patchTensorBuffSize);
205 for (
int i = 0;
i < 2; ++
i) {
206 for (
int j = 0;
j < 2; ++
j) {
207 for (
int k = 0;
k < 3; ++
k) {
208 for (
int l = 0; l < 3; ++l) {
211 patch_loc =
i + 2 * (
j + 2 * (
k + 3 * l));
213 patch_loc = l + 3 * (
k + 3 * (
j + 2 *
i));
215 for (
int x = 0;
x < 2; ++
x) {
216 for (
int y = 0;
y < 3; ++
y) {
217 for (
int z = 0; z < 5; ++z) {
230 sycl_device.deallocate(gpu_data_tensor);
231 sycl_device.deallocate(gpu_data_no_patch);
232 sycl_device.deallocate(gpu_data_single_patch);
233 sycl_device.deallocate(gpu_data_twod_patch);
234 sycl_device.deallocate(gpu_data_threed_patch);
int i
Definition: BiCGSTAB_step_by_step.cpp:9
A tensor expression mapping an existing array of data.
Definition: TensorMap.h:33
The tensor class.
Definition: Tensor.h:68
static const int DataLayout
Definition: cxx11_tensor_image_patch_sycl.cpp:24
@ ColMajor
Definition: Constants.h:318
Scalar * y
Definition: level1_cplx_impl.h:128
char char char int int * k
Definition: level2_impl.h:374
#define VERIFY_IS_EQUAL(a, b)
Definition: main.h:367
std::array< T, N > array
Definition: EmulateArray.h:231
list x
Definition: plotDoE.py:28
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2