Skip to content

Commit

Permalink
fix (#10549)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnXuan authored Aug 2, 2024
1 parent d025ab6 commit a575d22
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions python/oneflow/nn/modules/interpolate_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,14 @@ def interpolate_like(
>>> import oneflow as flow
>>> import numpy as np
>>> input = flow.tensor(np.arange(1, 5).reshape((1, 1, 4)), dtype=flow.float32)
>>> like = flow.randn(1, 1, 8)
>>> output = flow.nn.functional.interpolate_like(input, like, mode="linear")
>>> input = flow.tensor(np.arange(1, 5).reshape((1, 1, 2, 2)), dtype=flow.float32)
>>> like = flow.randn(1, 1, 4, 4)
>>> output = flow.nn.functional.interpolate_like(input, like, mode="nearest")
>>> output
tensor([[[1.0000, 1.2500, 1.7500, 2.2500, 2.7500, 3.2500, 3.7500, 4.0000]]],
dtype=oneflow.float32)
tensor([[[[1., 1., 2., 2.],
[1., 1., 2., 2.],
[3., 3., 4., 4.],
[3., 3., 4., 4.]]]], dtype=oneflow.float32)
"""
return InterpolateLike(mode=mode, align_corners=align_corners,).forward(input, like)
Expand Down

0 comments on commit a575d22

Please sign in to comment.