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
{{ message }}
This repository has been archived by the owner on Oct 15, 2019. It is now read-only.
Hey developers, here is a possible memory leakage issue that took me a lot of pain to track down...
If I run the following code a few times:
# Params: a minpy array of parameters# grad_J: minpy array of gradients wrt Params, returned by grad_and_loss object# init_params(): an initializer of the parametersinit_params(Params)
print(Params[:3])
print(grad_J[:3])
Params-=grad_J# This fails# Params[:] -= grad_J # This will workprint(Params[:3])
So obviously the '-=' operator is being applied to an obsolete copy of the parameters, that should not be in the memory as I have already overwritten it with the re-initialization op. And there are a few times I noticed the Params are simply overwritten by the grad_J with the '-=' op.
However the a very simple snippet of similar code works as expected in the same python session.
a=np.random.rand(5,)
b=np.random.rand(5,)
print(a)
print(b)
a-=bprint(a)
# first run
[ 0.787569340.562994150.99072079]
[ 0.464039420.89881060.45598527]
[ 0.32352993-0.33581650.53473556]
# second run
[ 0.562282820.849193520.05164077]
[ 0.021190640.156570830.67894815]
[ 0.541092160.69262266-0.62730742]
The version I am using is minpy (0.3.0).
The text was updated successfully, but these errors were encountered:
@chenyang-tao Sorry for the delay. Can you add the complete code snippet? like the definition of init_params and grad_J. I've made a similar example and run for many times. The obsolete copy thing doesn't happen in my case
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hey developers, here is a possible memory leakage issue that took me a lot of pain to track down...
If I run the following code a few times:
the outputs would be something like:
So obviously the '-=' operator is being applied to an obsolete copy of the parameters, that should not be in the memory as I have already overwritten it with the re-initialization op. And there are a few times I noticed the Params are simply overwritten by the grad_J with the '-=' op.
However the a very simple snippet of similar code works as expected in the same python session.
The version I am using is minpy (0.3.0).
The text was updated successfully, but these errors were encountered: