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

upsample_bilinear: fix output data-type. #7111

Merged
merged 4 commits into from
May 29, 2024

Conversation

ysiraichi
Copy link
Collaborator

Fix: #7095

This PR removes the data-type conversion inherited from the TF implementation when is_kernel_bilinear is set. We still do it on integer data-types, though.

Note: upsample_bilinear call on integral tensors (except torch.byte type) is not currently implemented on upstream PyTorch. It fails with:

Traceback (most recent call last):
  File "examples/upsample.py", line 16, in <module>
    out = foo(a)
  File "examples/upsample.py", line 7, in foo
    return torch.nn.functional.upsample_bilinear(x, scale_factor=2)
  File "torch/nn/functional.py", line 4203, in upsample_bilinear
    return interpolate(input, size, scale_factor, mode="bilinear", align_corners=True)
  File "torch/nn/functional.py", line 4082, in interpolate
    return torch._C._nn.upsample_bilinear2d(input, output_size, align_corners, scale_factors)
RuntimeError: "upsample_bilinear2d_channels_last" not implemented for 'Long'

cc @miladm @JackCaoG

@JackCaoG
Copy link
Collaborator

Seems like you need to resolve the conflict first.

@ysiraichi ysiraichi force-pushed the ysiraichi/fix-upsample-bilinear-dtype branch from 7cfe9b1 to 2c738c3 Compare May 28, 2024 23:36
@ysiraichi ysiraichi merged commit 468a5c9 into master May 29, 2024
19 checks passed
@JackCaoG
Copy link
Collaborator

I am going to revert this pr as it breaks the TPU CI. considering makeing this change GPU only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

upsample_bilinear2d HLO returns unexpected data-type.
2 participants