10000 Updated ONNX Opset Version to Support Attention Operator #153611 by hamzaqureshi5 · Pull Request #153687 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

Updated ONNX Opset Version to Support Attention Operator #153611 #153687

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

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Feat: added opset 21, 22 and 23
  • Loading branch information
hamzaqureshi5 committed May 16, 2025
commit d87fb8e2dd71b2f97582784a92ce9667d82ae15c
32 changes: 0 additions & 32 deletions torch/onnx/symbolic_opset21.py
8000
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,6 @@
https://github.com/onnx/onnx/blob/main/docs/Changelog.md#version-20-of-the-default-onnx-operator-set
New operators:
AffineGrid
ConstantOfShape
DFT
Gelu
GridSample
ImageDecoder
IsInf
IsNaN
ReduceMax
ReduceMin
RegexFullMatch
StringConcat
StringSplit
"""

import functools
Expand Down Expand Up @@ -70,23 +58,3 @@ def _grid_sampler(
)


# @_onnx_symbolic("aten::affine_grid_generator")
# @symbolic_helper.parse_args("v", "v", "b")
# def _affine_grid_generator(
# g: jit_utils.GraphContext,
# theta: _C.Value,
# size: _C.Value,
# align_corners: bool,
# ):
# return g.op(
# "AffineGrid",
# theta,
# size,
# align_corners_i=int(align_corners),
# )


# @_onnx_symbolic("aten::gelu")
# @symbolic_helper.parse_args("v", "s")
# def gelu(g: jit_utils.GraphContext, self: _C.Value, approximate: str = "none"):
# return g.op("Gelu", self, approximate_s=approximate)
28 changes: 4 additions & 24 deletions torch/onnx/symbolic_opset22.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# mypy: allow-untyped-defs
"""This file exports ONNX ops for opset 20.
"""This file exports ONNX ops for opset 22.

Note [ONNX Operators that are added/updated in opset 20]
Note [ONNX Operators that are added/updated in opset 22]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
https://github.com/onnx/onnx/blob/main/docs/Changelog.md#version-20-of-the-default-onnx-operator-set
https://github.com/onnx/onnx/blob/main/docs/Changelog.md#version-22-of-the-default-onnx-operator-set
New operators:
"""

Expand All @@ -28,7 +28,7 @@ def convert_grid_sample_mode(mode_s):
)


_onnx_symbolic = functools.partial(registration.onnx_symbolic, opset=21)
_onnx_symbolic = functools.partial(registration.onnx_symbolic, opset=22)


@_onnx_symbolic("aten::grid_sampler")
Expand Down Expand Up @@ -57,23 +57,3 @@ def _grid_sampler(
)


# @_onnx_symbolic("aten::affine_grid_generator")
# @symbolic_helper.parse_args("v", "v", "b")
# def _affine_grid_generator(
# g: jit_utils.GraphContext,
# theta: _C.Value,
# size: _C.Value,
# align_corners: bool,
# ):
# return g.op(
# "AffineGrid",
# theta,
# size,
# align_corners_i=int(align_corners),
# )


# @_onnx_symbolic("aten::gelu")
# @symbolic_helper.parse_args("v", "s")
# def gelu(g: jit_utils.GraphContext, self: _C.Value, approximate: str = "none"):
# return g.op("Gelu", self, approximate_s=approximate)
25 changes: 2 additions & 23 deletions torch/onnx/symbolic_opset23.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Note [ONNX Operators that are added/updated in opset 23]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
https://github.com/onnx/onnx/blob/main/docs/Changelog.md#version-20-of-the-default-onnx-operator-set
https://github.com/onnx/onnx/blob/main/docs/Changelog.md#version-23-of-the-default-onnx-operator-set
New operators:
Attention
"""
Expand All @@ -29,7 +29,7 @@ def convert_grid_sample_mode(mode_s):
)


_onnx_symbolic = functools.partial(registration.onnx_symbolic, opset=21)
_onnx_symbolic = functools.partial(registration.onnx_symbolic, opset=23)


@_onnx_symbolic("aten::grid_sampler")
Expand Down Expand Up @@ -57,24 +57,3 @@ def _grid_sampler(
padding_mode_s=padding_mode_s,
)


# @_onnx_symbolic("aten::affine_grid_generator")
# @symbolic_helper.parse_args("v", "v", "b")
# def _affine_grid_generator(
# g: jit_utils.GraphContext,
# theta: _C.Value,
# size: _C.Value,
# align_corners: bool,
# ):
# return g.op(
# "AffineGrid",
# theta,
# size,
# align_corners_i=int(align_corners),
# )


# @_onnx_symbolic("aten::gelu")
# @symbolic_helper.parse_args("v", "s")
# def gelu(g: jit_utils.GraphContext, self: _C.Value, approximate: str = "none"):
# return g.op("Gelu", self, approximate_s=approximate)
0