Skip to content

Remove deprecated onnx.mapping usage - #24484

Merged
justinchuby merged 2 commits into
mainfrom
justinchu/remove-mapping-usage
Apr 22, 2025
Merged

Remove deprecated onnx.mapping usage#24484
justinchuby merged 2 commits into
mainfrom
justinchu/remove-mapping-usage

Conversation

@justinchuby

@justinchuby justinchuby commented Apr 21, 2025

Copy link
Copy Markdown
Contributor

onnx.mapping was deprecated and is being removed. This PR updates removes deprecated usage.

@MaanavD would be good if this can make it into 1.22.0 for forward ONNX release (1.19+) compatibility.

@justinchuby
justinchuby requested a review from tianleiwu April 21, 2025 04:27
@justinchuby
justinchuby requested review from Copilot and snnn April 21, 2025 04:29
@justinchuby justinchuby added the merge on green This PR can be merged when the CI is green. Please merge. label Apr 21, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes deprecated usage of onnx.mapping by replacing it with the corresponding functions from onnx.helper. Main changes include:

  • Replacing onnx.mapping.TENSOR_TYPE_TO_NP_TYPE with onnx.helper.tensor_dtype_to_np_dtype and similar updates.
  • Removing the now-obsolete TENSOR_TYPE_MAP and NP_TYPE_TO_TENSOR_TYPE usages in test files.
  • Applying consistent refactoring across production and test code to support deprecation removal.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/python/ort_test_dir_utils.py Updated _get_numpy_type to return np.dtype and replaced mapping usage with helper.tensor_dtype_to_np_dtype.
onnxruntime/test/python/onnxruntime_test_python_iobinding.py Removed TENSOR_TYPE_MAP import and assertion, using helper.tensor_dtype_to_np_dtype instead.
onnxruntime/test/python/contrib_ops/onnx_contrib_ops_helper.py Replaced NP_TYPE_TO_TENSOR_TYPE with helper.np_dtype_to_tensor_dtype.
onnxruntime/test/onnx/gen_test_models.py Updated generate_reducesum_op_test to use helper.np_dtype_to_tensor_dtype.
onnxruntime/python/tools/transformers/fusion_utils.py Refactored to use helper.tensor_dtype_to_np_dtype in place of onnx.mapping usage.

@justinchuby

Copy link
Copy Markdown
Contributor Author

@snnn there are some github cis not being triggered. Could you help?

@snnn snnn closed this Apr 21, 2025
@snnn snnn reopened this Apr 21, 2025
@justinchuby
justinchuby merged commit 851d280 into main Apr 22, 2025
@justinchuby
justinchuby deleted the justinchu/remove-mapping-usage branch April 22, 2025 02:50
intbf pushed a commit to intbf/onnxruntime that referenced this pull request Apr 25, 2025
`onnx.mapping` was deprecated and is being removed. This PR updates
removes deprecated usage.

@MaanavD would be good if this can make it into 1.22.0 for forward ONNX
release (1.19+) compatibility.

Signed-off-by: bfilipek <bartlomiej.filipek@intel.com>
vraspar pushed a commit that referenced this pull request Apr 28, 2025
`onnx.mapping` was deprecated and is being removed. This PR updates
removes deprecated usage.

@MaanavD would be good if this can make it into 1.22.0 for forward ONNX
release (1.19+) compatibility.
jywu-mysoft pushed a commit that referenced this pull request Apr 30, 2025
### Description

Cherry pick the following into
[rel-1.22.0](https://github.com/microsoft/onnxruntime/tree/rel-1.22.0)


- (#24487)
- (#24466)
- (#24493)
- (#24484)
- (#24494)
- (#24489)
- (#24504)
- (#24510)
- (#24456)
- (#24537)
- (#24501)
- (#24519)
- (#24513)
- (#24539)
- (#24514)
- (#24542)
- (#24585)

Not added:

Planning to cherry pick Cuda Matmulnbits PRs once the fix for failing
cuda pipeline is ready
- (#24491)
- (#24509)
- (#24564)

---------

Co-authored-by: Adrian Lizarraga <adlizarraga@microsoft.com>
Co-authored-by: minfhong-quic <quic_minfhong@quicinc.com>
Co-authored-by: minfhong-quic <minfhong-quic@quicinc.com>
Co-authored-by: Justin Chu <justinchuby@users.noreply.github.com>
Co-authored-by: Prathik Rao <prathik.rao@gmail.com>
Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
Co-authored-by: Ankan Banerjee <ankan.ban@gmail.com>
Co-authored-by: Maximilian Müller <maximilianm@nvidia.com>
Co-authored-by: Gaurav Garg <gaugarg@nvidia.com>
Co-authored-by: iraut <iraut@nvidia.com>
Co-authored-by: Hrishikesh Manohar <hrishikeshm@nvidia.com>
Co-authored-by: Maximilian Müller <44298237+gedoensmax@users.noreply.github.com>
Co-authored-by: Scott McKay <skottmckay@gmail.com>
Co-authored-by: Jiajia Qin <jiajiaqin@microsoft.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: xhcao <xinghua.cao@intel.com>
jatinwadhwa921 pushed a commit to intel/onnxruntime that referenced this pull request Apr 30, 2025
### Description

Cherry pick the following into
[rel-1.22.0](https://github.com/microsoft/onnxruntime/tree/rel-1.22.0)


- (microsoft#24487)
- (microsoft#24466)
- (microsoft#24493)
- (microsoft#24484)
- (microsoft#24494)
- (microsoft#24489)
- (microsoft#24504)
- (microsoft#24510)
- (microsoft#24456)
- (microsoft#24537)
- (microsoft#24501)
- (microsoft#24519)
- (microsoft#24513)
- (microsoft#24539)
- (microsoft#24514)
- (microsoft#24542)
- (microsoft#24585)

Not added:

Planning to cherry pick Cuda Matmulnbits PRs once the fix for failing
cuda pipeline is ready
- (microsoft#24491)
- (microsoft#24509)
- (microsoft#24564)

---------

Co-authored-by: vraspar <vrajang@outlook.com>
Co-authored-by: Adrian Lizarraga <adlizarraga@microsoft.com>
Co-authored-by: minfhong-quic <quic_minfhong@quicinc.com>
Co-authored-by: minfhong-quic <minfhong-quic@quicinc.com>
Co-authored-by: Justin Chu <justinchuby@users.noreply.github.com>
Co-authored-by: Prathik Rao <prathik.rao@gmail.com>
Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
Co-authored-by: Ankan Banerjee <ankan.ban@gmail.com>
Co-authored-by: Maximilian Müller <maximilianm@nvidia.com>
Co-authored-by: Gaurav Garg <gaugarg@nvidia.com>
Co-authored-by: iraut <iraut@nvidia.com>
Co-authored-by: Hrishikesh Manohar <hrishikeshm@nvidia.com>
Co-authored-by: Maximilian Müller <44298237+gedoensmax@users.noreply.github.com>
Co-authored-by: Scott McKay <skottmckay@gmail.com>
Co-authored-by: Jiajia Qin <jiajiaqin@microsoft.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: xhcao <xinghua.cao@intel.com>
@snnn

snnn commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

This PR has been included in the rel-1.22.0 branch. Removing the release:1.22.0 label.

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

Labels

merge on green This PR can be merged when the CI is green. Please merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants