Skip to content

Commit

Permalink
Update _manipulation_functions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan committed Oct 5, 2024
1 parent ef2843c commit 649118a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions xarray/namedarray/_array_api/_manipulation_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ def reshape(
x: NamedArray[Any, _DType], /, shape: _ShapeType, *, copy: bool | None = None
) -> NamedArray[_ShapeType, _DType]:
"""
Reshapes an array without changing its data.
Examples
--------
Expand Down Expand Up @@ -366,8 +367,8 @@ def reshape(

if math.prod(shape) == -1:
# Flattening operations merges all dimensions to 1:
dims_raveled = _flatten_dims(x.dims)
dim = dims_raveled[0]
dims_flattened = _flatten_dims(x.dims)
dim = dims_flattened[0]
d = []
for v in shape:
d.append(dim if v == -1 else _new_unique_dim_name(tuple(d)))
Expand Down

0 comments on commit 649118a

Please sign in to comment.