Skip to content

[torchlib] Add aten::upsample_linear1d.vec - #3166

Open
Kyunggeun Lee (kyunggeunlee) wants to merge 1 commit into
microsoft:mainfrom
kyunggeunlee:torchlib-upsample-linear1d-vec
Open

Kyunggeun Lee (kyunggeunlee) wants to merge 1 commit into
microsoft:mainfrom
kyunggeunlee:torchlib-upsample-linear1d-vec

Conversation

@kyunggeunlee

Copy link
Copy Markdown

resolves #3165

Summary

Adds the missing aten::upsample_linear1d.vec overload to torchlib. aten::upsample_linear1d was already implemented, but the .vec overload, upsample_linear1d.vec(Tensor input, SymInt[]? output_size, bool align_corners, float[]? scale_factors), was not.

Changes

  • onnxscript/function_libs/torch_lib/ops/nn.py: add aten_upsample_linear1d_vec. It mirrors aten_upsample_bilinear2d_vec:
    • If scale_factors is given, it resizes via _aten_upsample_scales.
    • Otherwise it resizes via _aten_upsample_output_size, which requires output_size.
    • Both paths use mode="linear", with align_corners mapped to align_corners / half_pixel through _get_upsample_align_corners_mode.
  • tests/function_libs/torch_lib/extra_opinfo.py: add sample_inputs_upsample_linear1d_vec and the ops.aten.upsample_linear1d.vec OpInfo. Samples cover output sizes 3, 1 and 5, and scale_factors of [1.7], [0.6] and [4.2], each with align_corners both True and False.
  • tests/function_libs/torch_lib/ops_test_data.py: register ops.aten.upsample_linear1d.vec.

Testing

pytest tests/function_libs/torch_lib/ops_test.py -k upsample_linear1d
  • ops.aten.upsample_linear1d.vec output-match test passes on all samples, including align_corners=False with scale_factors. No xfail is needed.
  • The existing non-vec ops.aten.upsample_linear1d test is unchanged. It passes, and its known align_corners=False with scales xfail still applies.
  • The test_script_function_passes_checker tests are skipped for both ops, because trace-only functions have no function proto.

🤖 Generated with Claude Code

Add a conversion rule for the .vec overload of upsample_linear1d, mirroring
upsample_bilinear2d.vec, along with sample inputs, an OpInfo and a test entry.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Kyunggeun Lee <kyunggeu@qti.qualcomm.com>
@kyunggeunlee

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Qualcomm"

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

[torchlib] aten::upsample_linear1d.vec is not supported

1 participant