graphnet.utilities.deprecation_tools module

Utility functions for handling deprecation transitions.

graphnet.utilities.deprecation_tools.rename_state_dict_entries(state_dict, old_phrase, new_phrase)[source]

Replace old_phrase in state dict fields with new_phrase.

Returned state dict is a deepcopy of the input.

Parameters:
  • state_dict (Dict[str, Tensor]) – The state dict whos fields need renaming.

  • old_phrase (str) – Phrase in state dict field that needs to be replaced.

  • new_phrase (str) – Phrase to add in place of old_phrase in state dict.

Return type:

Tuple[Dict[str, Tensor], bool]