Skip to content

Commit

Permalink
improved docs examples readability
Browse files Browse the repository at this point in the history
  • Loading branch information
gboduljak committed Feb 9, 2024
1 parent 69f0643 commit 81a5ae1
Showing 1 changed file with 10 additions and 34 deletions.
44 changes: 10 additions & 34 deletions python/mlx/nn/layers/upsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,41 +84,17 @@ class Upsample2d(Module):
[[3],
[4]]]], dtype=int32)
>>> n = nn.Upsample2d(scale=2, mode='nearest')
>>> n(x)
array([[[[1],
[1],
[2],
[2]],
[[1],
[1],
[2],
[2]],
[[3],
[3],
[4],
[4]],
[[3],
[3],
[4],
[4]]]], dtype=int32)
>>> n(x).squeeze()
array([[1, 1, 2, 2],
[1, 1, 2, 2],
[3, 3, 4, 4],
[3, 3, 4, 4]], dtype=int32)
>>> b = nn.Upsample2d(scale=2, mode='bilinear')
>>> b(x)
array([[[[1],
[1.33333],
[1.66667],
[2]],
[[1.66667],
[2],
[2.33333],
[2.66667]],
[[2.33333],
[2.66667],
[3],
[3.33333]],
[[3],
[3.33333],
[3.66667],
[4]]]], dtype=float32)
>>> b(x).squeeze()
array([[1, 1.33333, 1.66667, 2],
[1.66667, 2, 2.33333, 2.66667],
[2.33333, 2.66667, 3, 3.33333],
[3, 3.33333, 3.66667, 4]], dtype=float32)
"""

def __init__(
Expand Down

0 comments on commit 81a5ae1

Please sign in to comment.