Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix unitnorm to be a class, like other constraints
brought to you by unittests
  • Loading branch information
phreeza committed Jul 2, 2015
commit 24be9eb88b899b3cc8ed0470bb4f72e33060698e
4 changes: 2 additions & 2 deletions keras/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def __call__(self, p):
p *= T.ge(p, 0)
return p

def UnitNorm(Constraint):
class UnitNorm(Constraint):
def __call__(self, p):
return e / T.sqrt(T.sum(e**2, axis=-1, keepdims=True))

identity = Constraint
maxnorm = MaxNorm
nonneg = NonNeg
unitnorm = UnitNorm
unitnorm = UnitNorm