Skip to content

upsample_bilinear: fix output data-type.#7111

Merged
ysiraichi merged 4 commits intomasterfrom
ysiraichi/fix-upsample-bilinear-dtype
May 29, 2024
Merged

upsample_bilinear: fix output data-type.#7111
ysiraichi merged 4 commits intomasterfrom
ysiraichi/fix-upsample-bilinear-dtype

Conversation

@ysiraichi
Copy link
Copy Markdown
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

@ysiraichi ysiraichi requested a review from JackCaoG May 24, 2024 20:30
@ysiraichi ysiraichi force-pushed the ysiraichi/fix-upsample-bilinear-dtype branch from 3a27d9b to 7cfe9b1 Compare May 24, 2024 22:25
@JackCaoG
Copy link
Copy Markdown
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
@JackCaoG
Copy link
Copy Markdown
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