Mercurial > pylearn
comparison nnet_ops.py @ 217:44dd9b6448c5
harmless typo in ScalarSoftplus.c_code
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Thu, 22 May 2008 19:08:46 -0400 |
parents | 3d953844abd3 |
children | df3fae88ab46 |
comparison
equal
deleted
inserted
replaced
216:4b7e89b75e2b | 217:44dd9b6448c5 |
---|---|
42 return numpy.log1p(numpy.exp(x)) | 42 return numpy.log1p(numpy.exp(x)) |
43 def impl(self, x): | 43 def impl(self, x): |
44 return ScalarSoftplus.static_impl(x) | 44 return ScalarSoftplus.static_impl(x) |
45 def grad(self, (x,), (gz,)): | 45 def grad(self, (x,), (gz,)): |
46 return [gz * scalar_sigmoid(x)] | 46 return [gz * scalar_sigmoid(x)] |
47 def c_code(self, name, node, (x,), (z,), sub): | 47 def c_code(self, node, name, (x,), (z,), sub): |
48 if node.inputs[0].type in [scalar.float32, scalar.float64]: | 48 if node.inputs[0].type in [scalar.float32, scalar.float64]: |
49 return """%(z)s = | 49 return """%(z)s = |
50 %(x)s < -30.0 | 50 %(x)s < -30.0 |
51 ? 0.0 | 51 ? 0.0 |
52 : %(x)s > 30.0 | 52 : %(x)s > 30.0 |