opto.features.priority_search.utils¶
get_original_name ¶
Extract the original name from a node, removing all _copy suffixes.
is_node_copy ¶
Check if two nodes are copies of each other by comparing their original names.
This function has transitivity: if A is a copy of B and B is a copy of C, then A is also considered a copy of C.
remap_update_dict ¶
Remap the update dict to the agent's parameters. update_dict might have keys which are copies of the base_module's parameters or visa versa. This function remaps the keys in update_dict to the original parameters of the base_module.
The return dict is empty if no keys in update_dict matched any parameters of the base_module. This condition can be used to check if the update_dict contains non-trivial updates.
set_module_parameters ¶
Set the parameters of the agent based on the update_dict. The update_dict is a dictionary of ParameterNode: value pairs. The agent's parameters will be updated with the values from the update_dict.
create_module_from_update_dict ¶
Create a new agent from the update_dict. The update_dict is a dictionary of ParameterNode: value pairs. A new agent will be created with the parameters set to the values from the update_dict.