8000 `onnx.compose.add_prefix_graph` ignores `rename_input=False/rename_output=False` · Issue #6754 · onnx/onnx · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

onnx.compose.add_prefix_graph ignores rename_input=False/rename_output=False #6754

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

Open
KarelZe opened this issue Mar 2, 2025 · 1 comment

Comments

@KarelZe
Copy link
KarelZe commented Mar 2, 2025

Bug Report

Is the issue related to model conversion?

No.

Describe the bug

onnx.compose.add_prefix_graph(..., prefix="...", rename_inputs=False, rename_outputs=False) renames inputs/outputs even if renaming is set to False.

System information

MacOS 15.3.1
python 3.11.10
onnx 1.17.0

Reproduction instructions

import onnx

g_text_1 = """
     identities (float[2,2] A) => (float[2,2] B)  
     {
     B = Identity(A)
     }
     """

g1 = onnx.parser.parse_graph(g_text_1)
onnx.checker.check_graph(g1)

g1_mod = onnx.compose.add_prefix_graph(g1, prefix="g1_", rename_outputs=False, rename_inputs=False)

print(g1_mod.input, g1_mod.output)

output:

[name: "g1_A"
type {
  tensor_type {
    elem_type: 1
    shape {
      dim {
        dim_value: 2
      }
      dim {
        dim_value: 2
      }
    }
  }
}
] [name: "g1_B"
type {
  tensor_type {
    elem_type: 1
    shape {
      dim {
        dim_value: 2
      }
      dim {
        dim_value: 2
      }
    }
  }
}
]

Expected behavior

According to https://github.com/onnx/onnx/blob/main/onnx/compose.py#L429, inputs and outputs should not be renamed.

add_prefix for ModelProto is equally affected (https://onnx.ai/onnx/_modules/onnx/compose.html#add_prefix)

Notes

I'd be happy to contribute a pr 👍

@KarelZe KarelZe added the bug label Mar 2, 2025
@KarelZe KarelZe changed the title onnx.compose_add_prefix_graph ignores rename_input=False/rename_output=False onnx.compose.add_prefix_graph ignores rename_input=False/rename_output=False Mar 3, 2025
@justinchuby
Copy link
Contributor

Please feel free to submit a pr, thanks!

Esttelle added a commit to Esttelle/onnx that referenced this issue Apr 4, 2025
Fix issue onnx#6754

Signed-off-by: Estelle <18220760769@163.com>
Esttelle added a commit to Esttelle/onnx that referenced this issue Apr 18, 2025
Fix issue onnx#6754

Signed-off-by: Estelle <18220760769@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0