Commit 726432d
committed
Resolve gh-1769
Modify shape.setter to handle integers.
```
In [1]: import dpctl.tensor as dpt
In [2]: x = dpt.ones((2, 3))
In [3]: x.shape = 6
In [4]: x
Out[4]: usm_ndarray([1., 1., 1., 1., 1., 1.], dtype=float32)
In [5]: x = dpt.ones((2, 3))
In [6]: class Six:
...: def __init__(self, dim=1):
...: self.v = (1,) * (dim - 1) + (6,)
...: def __len__(self):
...: return len(self.v)
...: def __iter__(self):
...: return iter(self.v)
...:
In [7]: x.shape = Six(3)
In [8]: x.shape
Out[8]: (1, 1, 6)
```1 parent d79dae1 commit 726432d
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
579 | | - | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
580 | 584 | | |
581 | 585 | | |
582 | 586 | | |
| |||
0 commit comments