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

'NaturalGradient' object has no attribute '_name' #2073

Open
kbryan-zjc opened this issue Jun 18, 2023 · 2 comments
Open

'NaturalGradient' object has no attribute '_name' #2073

kbryan-zjc opened this issue Jun 18, 2023 · 2 comments
Labels

Comments

@kbryan-zjc
Copy link

Bug / performance issue / build issue

To reproduce

Minimal, reproducible example

I was trying to replicate the [Heteroskedastic Likelihood and Multi-Latent GP](https://gpflow.github.io/GPflow/2.7.1/notebooks/advanced/heteroskedastic.html) example from the GPFlow library site. Everything ran fine except for the last snippet of code under "Run Optimization Loop" and is throwing an error: AttributeError: 'NaturalGradient' object has no attribute '_name'.

# This is the place for your code that reproduces the bug.
# Please make sure it does not depend on external libraries (beyond GPflow's own requirements) or specific datasets, and the smaller, the better :)
# For help on how to write a good bug report, see https://stackoverflow.com/help/minimal-reproducible-example

Stack trace, or error message

// Paste the full stack trace/error message here

Expected behavior

System information

  • GPflow version: 2.8.0
  • GPflow installed from: pip install
  • TensorFlow version: 2.11.0
  • Python version: 3.7
  • Operating system

Additional context

@kbryan-zjc kbryan-zjc added the bug label Jun 18, 2023
@Rafael-DB
Copy link

I believe this issue stems from the fact that the NaturalGradient class passes the name up through its super until the class _BaseOptimizer where it is stored as self.name. The _natgrad_steps function however tries to access self._name instead. A workaround that seems to do the job is just to set the name manually natgrad_opt._name = 'natgrad_opt'

@kbryan-zjc
Copy link
Author

kbryan-zjc commented Oct 18, 2023 via email

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

No branches or pull requests

2 participants