Skip to content

Shape setter does not work with integer scalar #1769

Closed
@antonwolfy

Description

@antonwolfy

The below example reproduces an issue with passing integer scalar to the shape setter:

import numpy, dpctl, dpctl.tensor as dpt

dpctl.__version__
# Out: '0.18.0dev0+158.g7450558d25'

a = dpt.usm_ndarray((2, 3))
a.shape = 6
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 a.shape = 6

File dpctl/tensor/_usmarray.pyx:579, in dpctl.tensor._usmarray.usm_ndarray.shape.__set__()

TypeError: object of type 'int' has no len()

# but works in numpy
a = numpy.ndarray((2, 3))
a.shape = 6

Metadata

Metadata

Assignees

No one assigned

    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