Skip to content

The in-place elementwise operator cannot operate on the largest dtype for the second value. #1757

Closed
@npolina4

Description

@npolina4

The in-place elementwise operator cannot operate on the largest dtype for the second value.

>>> import dpctl.tensor as dpt
>>> a = dpt.asarray(10, dtype="f4", device="cpu")
>>> b = dpt.asarray(5, dtype="f8", device="cpu")
>>> a += b
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "dpctl/tensor/_usmarray.pyx", line 1412, in dpctl.tensor._usmarray.usm_ndarray.__iadd__
  File "path_to_dpctl/dpctl/tensor/_elementwise_common.py", line 652, in __call__
    raise ValueError(
ValueError: Output array of type float64 is needed,got float32
>>> import numpy
>>> a = numpy.asarray(10, dtype="f4")
>>> b = numpy.asarray(5, dtype="f8")
>>> a += b
>>> a
array(15., dtype=float32)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions