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

[torchlib] Implement upsample_nearest{nd}.vec #1874

Merged
merged 11 commits into from
Sep 24, 2024
Merged
Changes from 2 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
12 changes: 12 additions & 0 deletions onnxscript/function_libs/torch_lib/ops/nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -2645,6 +2645,18 @@
return _aten_upsample_output_size(self, size, "nearest", "asymmetric")


@torch_op("aten::upsample_nearest3d.vec", trace_only=True)
def aten_upsample_nearest3d_vec(
justinchuby marked this conversation as resolved.
Show resolved Hide resolved
input: TReal,
output_size: INT64,
justinchuby marked this conversation as resolved.
Show resolved Hide resolved
scale_factors: Optional[Sequence[float]] = None,
) -> TReal:
"""upsample_nearest3d.vec(Tensor input, SymInt[]? output_size, float[]? scale_factors) -> Tensor"""

# TODO: Use scale_factors?
justinchuby marked this conversation as resolved.
Show resolved Hide resolved
return _aten_upsample_output_size(input, output_size, "nearest", "asymmetric")

Check warning on line 2657 in onnxscript/function_libs/torch_lib/ops/nn.py

View check run for this annotation

Codecov / codecov/patch

onnxscript/function_libs/torch_lib/ops/nn.py#L2657

Added line #L2657 was not covered by tests
justinchuby marked this conversation as resolved.
Show resolved Hide resolved


Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
def aten_upsample_nearest3d_backward(
grad_output: TensorType,
output_size: INT64,
Expand Down
Loading