174 IndexType sizeDim1 = 2;
175 IndexType sizeDim2 = 3;
176 IndexType sizeDim3 = 5;
177 IndexType sizeDim4 = 7;
178 IndexType sizeDim5 = 11;
180 Index5
strides(1L, 1L, 1L, 1L, 1L);
181 Index5 indicesStart(1L, 2L, 3L, 4L, 5L);
182 Index5 indicesStop(2L, 3L, 4L, 5L, 6L);
183 Index5 lengths(1L, 1L, 1L, 1L, 1L);
193 DataType* gpu_data1 =
static_cast<DataType*
>(sycl_device.allocate(tensor.size() *
sizeof(DataType)));
194 DataType* gpu_data2 =
static_cast<DataType*
>(sycl_device.allocate(slice1.size() *
sizeof(DataType)));
195 DataType* gpu_data_stride2 =
static_cast<DataType*
>(sycl_device.allocate(slice_stride1.size() *
sizeof(DataType)));
203 sycl_device.memcpyHostToDevice(gpu_data1, tensor.data(), (tensor.size()) *
sizeof(DataType));
204 gpu2.device(sycl_device) = gpu1.slice(indices,
sizes);
205 sycl_device.memcpyDeviceToHost(slice1.data(), gpu_data2, (slice1.size()) *
sizeof(DataType));
207 gpu_stride2.device(sycl_device) = gpu1.stridedSlice(indicesStart, indicesStop,
strides);
208 sycl_device.memcpyDeviceToHost(slice_stride1.data(), gpu_data_stride2, (slice_stride1.size()) *
sizeof(DataType));
217 DataType* gpu_data3 =
static_cast<DataType*
>(sycl_device.allocate(slice2.size() *
sizeof(DataType)));
218 DataType* gpu_data_stride3 =
static_cast<DataType*
>(sycl_device.allocate(strideSlice2.size() *
sizeof(DataType)));
223 Index5 strides2(1L, 1L, 1L, 1L, 1L);
224 Index5 indicesStart2(1L, 1L, 3L, 4L, 5L);
225 Index5 indicesStop2(2L, 2L, 5L, 6L, 8L);
227 gpu3.device(sycl_device) = gpu1.slice(indices2, sizes2);
228 sycl_device.memcpyDeviceToHost(slice2.data(), gpu_data3, (slice2.size()) *
sizeof(DataType));
230 gpu_stride3.device(sycl_device) = gpu1.stridedSlice(indicesStart2, indicesStop2, strides2);
231 sycl_device.memcpyDeviceToHost(strideSlice2.data(), gpu_data_stride3, (strideSlice2.size()) *
sizeof(DataType));
233 for (IndexType
i = 0;
i < 2; ++
i) {
234 for (IndexType
j = 0;
j < 2; ++
j) {
235 for (IndexType
k = 0;
k < 3; ++
k) {
241 sycl_device.deallocate(gpu_data1);
242 sycl_device.deallocate(gpu_data2);
243 sycl_device.deallocate(gpu_data3);
EIGEN_ALWAYS_INLINE DSizes< IndexType, NumDims > strides(const DSizes< IndexType, NumDims > &dimensions)
Definition: TensorBlock.h:29