Skip to content
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

[WIP] Implement upsample_bilinear2d_aa #8090

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion experimental/torch_xla2/test/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"__rpow__", # NOTE: cannot fix because torch test case has undefined behavior
# such as 0 to negative power.
"_segment_reduce",
"_upsample_bilinear2d_aa",
"bincount", # NOTE: dtype for int input torch gives float. This is weird.
"byte",
"cat",
Expand Down
14 changes: 14 additions & 0 deletions experimental/torch_xla2/torch_xla2/ops/jaten.py
Original file line number Diff line number Diff line change
Expand Up @@ -4095,3 +4095,17 @@ def _aten_max_unpoolxd(input, indices, output_size, stride=None, padding=0):

return output

@op(torch.ops.aten._upsample_bilinear2d_aa)
def _aten_upsample_bilinear2d_aa(input, output_size, align_corners, scale_factors):
if output_size is None:
raise ValueError("output_size value is not set correctly. It cannot be None or empty.")
# TODO: do we need a conversion from input to image ?
image = input
shape = output_size
method = "bilinear"
antialias = False # For upsampling
if align_corners:
raise ValueError("align_corners=true not supported yet")
# align_corners is not supported in resize()
# https://github.com/jax-ml/jax/issues/11206
return jax.image.resize(image, shape, method, antialias) # precision=Precision.HIGHEST