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

Fix bug with hidden_to_memory and no hidden_cell #26

Merged
merged 3 commits into from Nov 16, 2020

Conversation

drasmuss
Copy link
Member

There was an error if hidden_to_memory=True and hidden_cell=None (since there is no hidden state to direct to the memory input). This handles that case. Note that this is technically equivalent to memory_to_memory=True, so it's kind of a weird thing to do, but I thought it was worth supporting so that people doing parameter sweeps and things like that can see the effect of this case rather than having to particularly avoid it.

@drasmuss
Copy link
Member Author

After a bit more digging I was finding more and more awkward corner cases when you allow these hidden connections when hidden_cell=None. They're resolvable, but I think the "correct" behaviour is fairly unclear, and this is more likely to confuse users than be helpful (as well as making the code itself more complicated). So in the end I think it makes more sense to just not allow these cases (reversing what I said before). We don't lose any functionality (allowing hidden_to_memory is the same as memory_to_memory, as noted above, and input_to_hidden is equivalent to a skip connection, which can be created outside the LMU), and it makes everything cleaner.

So now this PR just adds a validation error for these cases.

Copy link
Contributor

@gsmalik gsmalik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think everything looks great. I just added 3 very minor comments. Thanks!

keras_lmu/layers.py Show resolved Hide resolved
keras_lmu/tests/test_layers.py Show resolved Hide resolved
keras_lmu/tests/test_layers.py Show resolved Hide resolved
NengoBones and others added 2 commits November 16, 2020 11:08
05546fe - Add isort configuration and check in static.sh
5854388 - Ensure black pre-commit only runs on .py files
56bf233 - Use separate passwords for PyPI and TestPyPI
@drasmuss drasmuss merged commit 3bbe5ba into master Nov 16, 2020
@drasmuss drasmuss deleted the fix-hidden-memory-none branch November 16, 2020 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants