Skip to content

Commit 3d15ef3

Browse files
committed
Fix the UpsamplingNearest2d's symbolic
1 parent 47fadc3 commit 3d15ef3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

torch/nn/_functions/thnn/upsampling.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,10 @@ def symbolic(g, input, size=None, scale_factor=None):
175175
if scale_factor is None:
176176
scale_factor = 1.0
177177
if size is not None and set(size) != set([None]):
178-
warnings.warn("ONNX export failed on UpsamplingNearest2d because size is not supported")
179-
return g.op("ResizeNearest", input, width_scale_f=scale_factor, height_scale_f=scale_factor)
178+
from torch.onnx.symbolic import _unimplemented
179+
return _unimplemented("UpsamplingNearest2d", "size")
180+
return g.op("Upsample", input, width_scale_f=scale_factor,
181+
height_scale_f=scale_factor, mode_s="nearest")
180182

181183
@staticmethod
182184
def forward(ctx, input, size=None, scale_factor=None):

0 commit comments

Comments
 (0)