Skip to content

Commit

Permalink
[ONNX] Do not run 'deduplicate_initializers' when 'keep_initializers_…
Browse files Browse the repository at this point in the history
…as_inputs' is True

ghstack-source-id: fead9d663757be87f05487c2816f95bf5c78a4eb
Pull Request resolved: #96320
  • Loading branch information
BowenBao committed Aug 1, 2023
1 parent f23d755 commit abd4cfb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions torch/onnx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1603,9 +1603,11 @@ def _export(
module_typenames_to_export_as_functions,
list(params_dict.keys()),
)
params_dict = _C._jit_pass_onnx_deduplicate_initializers( # type: ignore[assignment]
graph, params_dict, getattr(model, "training", False) # type: ignore[arg-type]
)

if keep_initializers_as_inputs is not True:
params_dict = _C._jit_pass_onnx_deduplicate_initializers( # type: ignore[assignment]
graph, params_dict, getattr(model, "training", False) # type: ignore[arg-type]
)
_C._jit_pass_onnx_assign_scoped_names_for_node_and_value(graph)
if export_params:
(
Expand Down

0 comments on commit abd4cfb

Please sign in to comment.