Skip to content

Commit

Permalink
Compile
Browse files Browse the repository at this point in the history
  • Loading branch information
pchavanne committed Feb 27, 2017
1 parent 9124f52 commit 91781e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/test_activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ def test_get_activation():
def test_activation_to_conf():
activation = yadll.activations.get_activation(yadll.activations.relu)
conf = yadll.activations.activation_to_conf(activation)
assert conf == ('relu', {})
assert conf == 'relu'
activation = yadll.activations.get_activation((yadll.activations.relu, {'alpha': 0.5}))
conf = yadll.activations.activation_to_conf(activation)
assert conf == ('relu', {'alpha': 0.5})
activation = yadll.activations.get_activation('relu')
conf = yadll.activations.activation_to_conf(activation)
assert conf == ('relu', {})
assert conf == 'relu'
activation = yadll.activations.get_activation(('relu', {'alpha': 0.5}))
conf = yadll.activations.activation_to_conf(activation)
assert conf == ('relu', {'alpha': 0.5})
Expand Down
8 changes: 4 additions & 4 deletions yadll/activations.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ def activation(x):

def activation_to_conf(activation):
func_name = activation.__closure__[0].cell_contents.__name__
try:
kwargs = activation.__closure__[1].cell_contents
conf = (func_name, kwargs)
except IndexError:
kwargs = activation.__closure__[1].cell_contents
if kwargs == {}:
conf = func_name
else:
conf = (func_name, kwargs)
return conf


Expand Down

0 comments on commit 91781e8

Please sign in to comment.