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

Questions about custom_lstm.py:AttributeError: can't set attribute #1

Open
onewarmheart opened this issue Jul 24, 2018 · 1 comment

Comments

@onewarmheart
Copy link

Hi,
Thanks for your RDPG code.It helps me a lot!
But I I seem to have encountered some difficulties when I run your code.
"spyder" report this:

AttributeError: can't set attribute

And the error comes from "custom_lstm.py"

  # modifications for accessing weights
  self.weights = matrix   
  self.bias = bias_term 

I don't know how to handle this problem, have u met this ?
Does not the new version of tensorflow support this attribute operation?
ps: I did a few changes(only several functions) to your code for matching the newer tf version.

Thanks again!

Hill

@quen-de
Copy link

quen-de commented May 16, 2019

Hi there,

This is probably irrelevant for you now, but for the sake of some potential recent readers I'll answer. This was indeed coded with an earlier version of TF, arguments of tf.concat and tf.split must be changed and tf.pack is now tf.stack.

About the "can't set attribute error", from my understanding it looks like self.weights is now a reserved name for the keras framework, and trying to overwrite it doesn't do well. Changing the name of the attribute to self._weights for example will do the trick.

I would not advise using this implementation for any other purpose than playing with it though, there are quite a few problems, not only from an optimization standpoint:

  • there is no need to define a custom cell to access weights (see collections and trainable variables)
  • layers in the RNNs are the same object duplicated instead of declared separately (!!!)
  • no bounded action for the actor (stability issues, but easy to solve)
  • multiple sessions declared simultaneously
  • no critic regularization, etc.

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

2 participants