Mutability of variational state parameters. #1893
-
Hi all, In this page here under "Manipulating the parameters" it says that if you do not use I am on netket version Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think the documentation is correct in general. See the following example In [18]: a = {'a': { 'b':1}}
In [19]: a_copy=a.copy()
In [20]: a['a']['b']=2
In [21]: a_copy
Out[21]: {'a': {'b': 2}}
In [22]: a_flax_copy=flax.core.copy(a, {})
In [23]: a['a']['b']=3
In [24]: a_flax_copy
Out[24]: {'a': {'b': 2}} However, for the particular case you considered, NetKet is trying hard to ensure you do not modify the parameters within Line 71 in c9c1061 This is because the variational state, to work correctly, requires that if you modify the parameters, you reassign them with |
Beta Was this translation helpful? Give feedback.
I think the documentation is correct in general. See the following example
However, for the particular case you considered, NetKet is trying hard to ensure you do not modify the parameters within
vs.parameters
directly, and internally returns you a copy obtained withflax.core.copy
of the parameters.See
netket/netket/vqs/base.py
Line 71 in c9c1061
This is because the variational state, to work correc…