Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hope release a weightnorm code that can be used for keras using theano backend #1

Open
jf003320018 opened this issue Dec 9, 2016 · 3 comments

Comments

@jf003320018
Copy link

jf003320018 commented Dec 9, 2016

It seems that the weight norm code for keras uses tensorflow backend. I try to modify it as a theano backend based code, but failed.
So hope to release a weightnorm code that can be used for keras using theano backend. Thank you.

@redst4r
Copy link

redst4r commented Dec 11, 2016

just changing the existing tf.XYZ() calls into the corresponding keras.backend. calls doesnt work?

@jf003320018
Copy link
Author

Do you try it? I have change the tf.XXX function to K.XXX function in theano backend by looking their meanings, but tf.get_variable_shape() and K.get_variable_shape() using theano backend is different. So It pop up an error.

@engharat
Copy link

engharat commented Feb 6, 2017

I'm trying to modify the code for theano backend as you, but I encounter several obstacles. jf003320018 did you manage to convert the code? It is not ( or not only) a matter of different function meanings, as keras implement a set of function both for tensorflow and for theano.
I think the problem stays in the function:
def get_weightnorm_params_and_grads(p, g):
The first fix to be done is:
V_scaler_shape = (ps[-1],) to V_scaler_shape = (ps[0],) as there is the problem of tensor ordering convention.
Still, the fix isn't enough because of some tesnor manipulation in the rest of the function. I tried putting [0] instead of [-1] in the other lines of code, but it is not working and I'm not understanding into detail how these lines of code are working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants