mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
Zhijxu/improve ortmodule python perf a little bit (#13716)
improve 2 python functions a little bit. according to a profiling result from a real user case, we find that 2 python function can be improved. the first is the result before improvement, the second is after improvement, we can see 8ms saved from the improvement.  
This commit is contained in:
parent
00c2bf39bd
commit
630c877b43
1 changed files with 3 additions and 1 deletions
|
|
@ -206,7 +206,7 @@ def _combine_input_buffers_initializers(
|
|||
_expand_inputs(inputs, non_none_inputs)
|
||||
flattened_kwargs_inputs = {}
|
||||
_expand_inputs(kwargs, flattened_kwargs_inputs)
|
||||
buffer_names_dict = {buffer_name: inp for buffer_name, inp in named_buffer}
|
||||
buffer_names_dict = None
|
||||
result = []
|
||||
embed_sparsity_results = OrderedDict()
|
||||
label_sparsity_results = OrderedDict()
|
||||
|
|
@ -232,6 +232,8 @@ def _combine_input_buffers_initializers(
|
|||
|
||||
if inp is None:
|
||||
# Registered buffers are translated to user_input+initializer in ONNX
|
||||
if buffer_names_dict is None:
|
||||
buffer_names_dict = {buffer_name: i for buffer_name, i in named_buffer}
|
||||
try: # noqa: SIM105
|
||||
inp = buffer_names_dict[name]
|
||||
except KeyError:
|
||||
|
|
|
|||
Loading…
Reference in a new issue