Skip to content

Redundant initializers introduced to the models using eliminate passes. #176

@researcher-no-name

Description

@researcher-no-name

I noticed an odd behavior, when using R-CNN models from ONNX Model Hub: The optimizer adds redundant initializer nodes to the models, in different passes (e.g., eliminate_shape_gather and eliminate_nop_reshape). Upon execution, they are removed and the models work, however the models get bloated this way and it would be nice to resolve this, as it has to do with eliminate passes which are part of the default optimization bundle.

Pass: eliminate_shape_gather, Model: Faster R-CNN R-50-FPN-int8, opset=12
2025-03-18 19:36:45.016246632 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2797'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016284009 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2473'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016317849 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2586'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016338868 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2561'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016384071 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2034'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016395604 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '1738'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016400882 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2555'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016446202 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2499'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016466860 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2476'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016477887 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2583'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016498564 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2505'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016528857 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2527'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016550868 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2479'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016557028 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2502'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016563560 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2530'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016569462 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2533'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016575731 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2558'. It is not used by any node and should be removed from the model.
2025-03-18 19:36:45.016582126 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '2589'. It is not used by any node and should be removed from the model.

Pass: eliminate_nop_reshape, Model: Faster R-CNN R-50-FPN-int8, opset=12
2025-03-18 19:37:51.308402762 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '823'. It is not used by any node and should be removed from the model.
2025-03-18 19:37:51.308431172 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '579'. It is not used by any node and should be removed from the model.
2025-03-18 19:37:51.308496786 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '640'. It is not used by any node and should be removed from the model.
2025-03-18 19:37:51.308506370 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '762'. It is not used by any node and should be removed from the model.
2025-03-18 19:37:51.308530685 [W:onnxruntime:, graph.cc:3553 CleanUnusedInitializersAndNodeArgs] Removing initializer '701'. It is not used by any node and should be removed from the model.

Similar results apply for "Faster R-CNN R-50-FPN-qdq.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions