You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OmegaConf containers has a reference to the parent node.
This is to provide features like interpolations and the ability to provide the full key of a node (including the parent keys) in errors.
This means that there is a bi-birectional links between a container (DictConfig, ListConfig) and a node (DictConfig, ListConfig, AnyNode, IntNode etc).
Consider:
a:
b:
c: 10
The links are as follows:
a -> b, b -> a
b -> c, c -> b
If we copy a with a shallow copy, we end up with:
a -> b
b -> c, c -> b
# new links
a1 -> b, b -> a1
Since b is the same object (shallow copy!), it can only have one parent. When we set the parent to a1, the parent is no longer a.
this is breaking the data model. if b (or one of it's children) is an interpolation, it's value might be changed now by changes to the a1 config tree.
One may think that we can solve it by copying b as well:
a -> b, b -> a
b -> c
a1 -> b1, b1 -> a1
b1 -> c, c -> b1
But now we have the same problem with c.
The only real solution is to perform a deepcopy instead of a shallow copy.
The text was updated successfully, but these errors were encountered:
OmegaConf containers has a reference to the parent node.
This is to provide features like interpolations and the ability to provide the full key of a node (including the parent keys) in errors.
This means that there is a bi-birectional links between a container (DictConfig, ListConfig) and a node (DictConfig, ListConfig, AnyNode, IntNode etc).
Consider:
The links are as follows:
If we copy a with a shallow copy, we end up with:
Since b is the same object (shallow copy!), it can only have one parent. When we set the parent to a1, the parent is no longer a.
this is breaking the data model. if b (or one of it's children) is an interpolation, it's value might be changed now by changes to the a1 config tree.
One may think that we can solve it by copying b as well:
But now we have the same problem with c.
The only real solution is to perform a deepcopy instead of a shallow copy.
The text was updated successfully, but these errors were encountered: