Skip to content

Rename (and move) transpose to permute_dims #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/API_specification/array_object.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ Transpose of the array.
The array instance must be two-dimensional. If the array instance is not two-dimensional, an error should be raised.

```{note}
Limiting the transpose to two-dimensional arrays (matrices) deviates from the NumPy et al practice of reversing all axes for arrays having more than two-dimensions. This is intentional, as reversing all axes was found to be problematic (e.g., conflicting with the mathematical definition of a transpose which is limited to matrices; not operating on batches of matrices; et cetera). In order to reverse all axes, one is recommended to use the functional `permute` interface found in this specification.
Limiting the transpose to two-dimensional arrays (matrices) deviates from the NumPy et al practice of reversing all axes for arrays having more than two-dimensions. This is intentional, as reversing all axes was found to be problematic (e.g., conflicting with the mathematical definition of a transpose which is limited to matrices; not operating on batches of matrices; et cetera). In order to reverse all axes, one is recommended to use the functional `permute_dims` interface found in this specification.
```

#### Returns
Expand Down
21 changes: 21 additions & 0 deletions spec/API_specification/manipulation_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,27 @@ Reverses the order of elements in an array along the given axis. The shape of th

- an output array having the same data type and shape as `x` and whose elements, relative to `x`, are reordered.

(function-permute-dims)=
### permute_dims(x, /, axes)

Permutes the axes (dimensions) of an array `x`.

#### Parameters

- **x**: _<array>_

- input array.

- **axes**: _Tuple\[ int, ... ]_

- tuple containing a permutation of `(0, 1, ..., N-1)` where `N` is the number of axes (dimensions) of `x`.

#### Returns

- **out**: _<array>_

- an array containing the axes permutation. The returned array must have the same data type as `x`.

(function-reshape)=
### reshape(x, /, shape)

Expand Down