-
Notifications
You must be signed in to change notification settings - Fork 321
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
GradientTape "AttributeError: 'KerasTensor' object has no attribute '_id'" #543
Comments
Hi, thanks for posting! You're on the right track. :) The reason this works in the Python project associated w/ that paper is because they disable eager mode: https://github.com/jleinonen/downscaling-rnn-gan/blob/e136192e4786e7d0a1832f42854e5ef642698570/dsrnngan/train.py#L7 You could do the same in R, if you want. :) But, there is a way to calculate this gradient penalty with A PR with an adaptation of that example to R would be very welcome :) It could then be hosted here: https://tensorflow.rstudio.com/examples/ (via https://github.com/rstudio/tensorflow.rstudio.com/). |
Thanks, this looks like a huge nudge in the right direction! I'll give it a go :) |
There is also a GAN implementation, and a |
@sirimet did you solve this? I'm getting the same problem trying to compute the gradients... |
@nickschurch me too |
@lainconn Can you please open a new issue with instructions to reproduce the error? |
@t-kalinowski Sorry for bothering, I fixed my issue |
Can you tell me how you solved it? I had the same problem, thanks |
Can you tell me how you solved it? I had the same problem, thanks |
@ZFH-AI, can you please open a new issue with a minimal example code snippet that reproduces the error? |
Brief intro
I apologize if this is not the correct forum for this question, but any help would be greatly appreciated! I already asked here, but it's a very tensorflow specific question.
I'm trying to build a Wasserstein GAN with gradient penalty, following this paper. Essentially, I'm trying to recreate their python code in R. All was going well until I tried to implement their gradient penalty. In the original code, they've defined it as a class, and they use K.gradients to calculate the gradients:
I generally try to avoid classes in R, and write things as functions instead. I think the rest will be better explained with what I'm hoping can work as a minimal reproducible example.
Session info
Reproducible example
This produces the error
I won't try to hide the fact that I don't quite understand what GradientTape is, which might explain why I can't get the following to work. However, I've been googling it for weeks and I'm not getting any wiser!
If I try "watching" one variable or the other, I get:
Any clues as to what I might be doing wrong?
The text was updated successfully, but these errors were encountered: