Skip to content

Commit

Permalink
Use getattr to allow function-only activations.
Browse files Browse the repository at this point in the history
  • Loading branch information
Leif Johnson committed Jul 10, 2015
1 parent 9720e63 commit 325e43a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions theanets/layers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def __init__(self, size, inputs, name=None, activation='logistic', **kwargs):
@property
def params(self):
'''A list of all parameters in this layer.'''
return self._params + self.activate.params
return self._params + getattr(self.activate, 'params', [])

@property
def num_params(self):
Expand Down Expand Up @@ -312,7 +312,7 @@ def log(self):
self.name,
inputs,
self.size,
self.activate.name,
getattr(self.activate, 'name', self.activate),
self.num_params)

def _fmt(self, string):
Expand Down
2 changes: 1 addition & 1 deletion theanets/layers/recurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def log(self):
inputs,
self.size,
' '.join(str(T) for T in self.periods),
self.activate.name,
getattr(self.activate, 'name', self.activate),
self.num_params)

def transform(self, inputs):
Expand Down

0 comments on commit 325e43a

Please sign in to comment.