Skip to content

ir_naming

torch_to_nnef.torch_graph.ir_naming

apply_nnef_variable_naming_scheme

apply_nnef_variable_naming_scheme(torch_ir_graph, scheme: VariableNamingScheme = DEFAULT_VARNAME_SCHEME)

Rename availlable data node following a scheme.

by default the natural_verbose pattern built is as close as possible to PyTorch graph context info. This pattern might come as too verbose.

we propose a more concise numeric pattern that allow easier debug when looking at NNEF export correctness.

remove_useless_digits_from_module_names

remove_useless_digits_from_module_names(torch_mod_ir_graph, lower: bool)

Cleanup final namings in graph.

  • Remove useless digits from module names for example: '_20__post_attention_layernorm_4__weight_expanded_1__weight' would become '_20__post_attention_layernorm__weight_expanded__weight' if there is no naming collision with this simlification