Skip to content

Commit

Permalink
Merge branch 'upsample-2d' of github.com:gboduljak/mlx into upsample-2d
Browse files Browse the repository at this point in the history
  • Loading branch information
gboduljak committed Feb 9, 2024
2 parents 81a5ae1 + 8fb7ddf commit 57eb900
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions python/mlx/nn/layers/upsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ class Upsample2d(Module):
- ``C`` is the number of input channels
Parameters:
scale (float or Tuple[float, float]): The multiplier for spatial size.
If a single number is provided, the provided value is the
multiplier for both the height and width. Otherwise, the first
element of the tuple is the height multipler, while the second is
the width multipler.
mode (str, optional): The upsampling algorithm: one of ``nearest`` and
``bilinear``. Default: ``nearest``.
scale (float or Tuple[float, float]): The multiplier for the spatial size.
If a ``float`` is provided, it is the multiplier for both the height and
width. Otherwise, the first element of the tuple is the height multiplier
and the second is the width multiplier.
mode (str, optional): The upsampling algorithm: one of ``"nearest"`` and
``"bilinear"``. Default: ``"nearest"``.
Examples:
>>> import mlx.core as mx
Expand Down Expand Up @@ -104,7 +103,7 @@ def __init__(
):
super().__init__()
if mode not in ["nearest", "bilinear"]:
raise ValueError("[upsample2d] unsupported upsampling algorithm")
raise ValueError(f"[Upsample2d] Got unsupported upsampling algorithm: {mode}")
if isinstance(scale, (list, tuple)):
self.scale = tuple(map(float, scale))
else:
Expand Down

0 comments on commit 57eb900

Please sign in to comment.