Closed
Description
Reproducer:
import dpctl.tensor as dpt
import intel_extension_for_pytorch
import torch
array_dpt_gpu = dpt.reshape(dpt.arange(1000, device="gpu", dtype=dpt.float32), (4, 250))
array_dpt_gpu_F_aligned = dpt.asarray(array_dpt_gpu, order="F")
array_torch = dpt.from_dlpack(array_dpt_gpu_F_aligned)
where array_torch
first (truncated) row outputs:
tensor([[ 0., 250., 500., 750., 1., 251., 501., 751., 2., 252., 502., 752.,
3., 253., 503., 753., 4., 254., 504., 754., 5., 255., 505., 755.,
6., 256., 506., 756., 7., 257., 507., 757., 8., 258., 508., 758.,
9., 259., 509., 759., 10., 260., 510., 760., 11., 261., 511., 761.,
which is different from array_dpt_gpu
or array_dpt_gpu_F_aligned
:
usm_ndarray([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.,
10., 11., 12., 13., 14., 15., 16., 17., 18., 19.,
20., 21., 22., 23., 24., 25., 26., 27., 28., 29.,
30., 31., 32., 33., 34., 35., 36., 37., 38., 39.,
it seems that from_dlpack
in pytorch can't see F-alignments and assumes C-contiguous buffer instead.