Skip to content

Add 'aten_upsample_bilinear2d_vec' for unet #1249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion onnxscript/function_libs/torch_lib/ops/nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -2306,11 +2306,23 @@ def aten_upsample_bilinear2d(
result = _aten_upsample_bilinear2d_output_size(self, output_size)
else:
assert scales_h is not None
assert scales_h == scales_w
assert scales_h == scales_w, f"scale_h({scales_h}) != scale_w({scales_w})"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why there is this restriction.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiaowuhu could you help?

result = _aten_upsample_bilinear2d_scales(self, scales_h, scales_w)
return result


@torch_op("aten::upsample_bilinear2d.vec", trace_only=True)
def aten_upsample_bilinear2d_vec(
self: TReal,
output_size: Optional[INT64] = None,
align_corners: bool = True,
scale_factors: Optional[Sequence[float]] = None,
) -> TReal:
return aten_upsample_bilinear2d(
self, output_size, scale_factors[0], scale_factors[1], align_corners
)


@torch_op("aten::upsample_bilinear2d", private=True)
def _aten_upsample_bilinear2d_output_size(
self: TReal,
Expand Down