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

Var.shape and Var.init.shape do not match #838

Open
erik-ski opened this issue Feb 28, 2024 · 0 comments
Open

Var.shape and Var.init.shape do not match #838

erik-ski opened this issue Feb 28, 2024 · 0 comments
Labels
0-needs-review For all new issues 1-bug Something isn't working

Comments

@erik-ski
Copy link

Describe the bug
It is possible to create a Var object whose declared shape and "real shape" (i.e. the shape of the array it holds, passed as the init parameter) differ.
To reproduce current behavior
Steps to reproduce the behavior:

  1. When I run this code
def my_code():
  shape = (2,2) # innocent shape declaration
  weights = np.array([[1, -1], [-1, 1]]) # init value, corresponding to the shape
  v = Var(shape=(shape, shape), init=weights) # wrong/strange shape declaration (this is similar to the first block of code from tutorial02_ecxitatory_inhibitory_network.ipynb)
  print(v.shape)
  print(v.init.shape)
if __name__ == "__main__":
  # the var shape attribute and the init value shape should match?
  my_code()
  1. I get this error ...
shapes won't match

Expected behavior
an AssertionError should have happened impeding me to declare such a Var

Environment (please complete the following information):

  • Device: Laptop
  • OS:Ubuntu Linux 20.04
  • Lava 0.9.0

Additional context
I found this in the first block of code from tutorial02_ecxitatory_inhibitory_network.ipynb, in the line

self.weights = Var(shape=(full_shape, full_shape), init=weights)

The tutorial is from the commit 5ed88f7

@erik-ski erik-ski added the 1-bug Something isn't working label Feb 28, 2024
@github-actions github-actions bot added the 0-needs-review For all new issues label Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-needs-review For all new issues 1-bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant