Skip to content

Commit

Permalink
Merge pull request #997 from rizar/input_dim_for_lookup_table
Browse files Browse the repository at this point in the history
Adds input_dim setter to LookupTable
  • Loading branch information
dmitriy-serdyuk committed Feb 22, 2016
2 parents c25a5f0 + c67e11e commit aa07fd8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions blocks/bricks/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ def get_dim(self, name):
def input_dim(self):
return 0

@input_dim.setter
def input_dim(self, dim):
if dim != 0:
raise ValueError("LookupTable input must be integer")

@property
def output_dim(self):
return self.dim
Expand Down
3 changes: 2 additions & 1 deletion tests/bricks/test_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ def test_lookup_table():

def assign_input_dim():
lt.input_dim = 11
assert_raises(AttributeError, assign_input_dim)
assert_raises(ValueError, assign_input_dim)
lt.input_dim = 0

0 comments on commit aa07fd8

Please sign in to comment.