Skip to content

Commit

Permalink
edit: add Codebyte example to transpose.md (#5437)
Browse files Browse the repository at this point in the history
* add Codebyte example to transpose.md

* Update transpose.md

minor changes

---------

Co-authored-by: Mamta Wardhani <mamta.wardhani@gmail.com>
Co-authored-by: Savi Dahegaonkar <124272050+SaviDahegaonkar@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 13, 2024
1 parent f10103d commit 56aa4f1
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ If possible, the `ndarray` returned will be a view of the original `ndarray`'s d

## Example

The below example creates an `ndarray` and then uses `.transpose()` on it.
The below example creates an `ndarray` and then uses `.transpose()` on it:

```py
import numpy as np
Expand All @@ -50,3 +50,16 @@ This produces the following output:
[2 5]
[3 6]]
```

## Codebyte Example

The `axes` argument allows control over the specific reordering of dimensions in a tensor. Run the below codebyte example to see how `.transpose()` can be used to rearrange the three dimensions of a 3D array:

```codebyte/python
import numpy as np
array_3d = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
print(array_3d)
print(np.transpose(array_3d))
```

0 comments on commit 56aa4f1

Please sign in to comment.