import dpctl.tensor as dpt
import numpy
a = numpy.arange(24).reshape(2, 3, 4) - 10
a.dtype
>dtype('int64')
dpt_a = dpt.asarray(a)
numpy.all(a,axis=0)
>array([[ True, True, True, True],
[ True, True, True, True],
[ True, True, False, True]])
dpt.all(dpt_a,axis=0)
>usm_ndarray([[ True, False, False, False],
[False, False, False, False],
[False, False, False, False]])
# at the same for dtype=int32
# floating types and boolean work correctly
a = a.astype('float32')
dpt_a = dpt.asarray(a)
numpy.all(a,axis=0)
>array([[ True, True, True, True],
[ True, True, True, True],
[ True, True, False, True]])
dpt.all(dpt_a,axis=0)
>usm_ndarray([[ True, True, True, True],
[ True, True, True, True],
[ True, True, True, True]])
import dpctl.tensor as dpt
import numpy
a = numpy.arange(24).reshape(2, 3, 4) - 10
dpt_a = dpt.asarray(a)
dpt.all(dpt_a,axis=0)
> Segmentation fault
dpt_a = dpt.astype(dpt_a, 'float32')
dpt.all(dpt_a,axis=0)
> Segmentation fault
dpt_a = dpt.astype(dpt_a, 'bool')
> usm_ndarray([[ True, True, True, True],
[ True, True, True, True],
[False, False, True, False]])
# for ndim<3 works
a = numpy.arange(6).reshape(2, 3) - 4
dpt_a = dpt.asarray(a)
dpt.all(dpt_a,axis=0)
> usm_ndarray([ True, False, True])
import dpctl.tensor as dpt
dpt_a = dpt.ones((2, 3, 4))
dpt.any(dpt_a,axis=0)
Segmentation fault (core dumped)
The
dpctl.tensor.allfunction returns an incorrect result with the parameteraxis=0anddimension >=3of the input ndarray.Running on GPU
Running on CPU for integer and floating types throws
Segmentation faultfor boolean type incorrect result
The
dpctl.tensor.anyfunction does not work on CPU (Segmentation fault) with the parameteraxis=0anddimension >=3of the input ndarray for all dtypes.