Mercurial > pylearn
comparison nnet_ops.py @ 222:f6a7eb1b7970
redo what James had done, so invert node and name
author | Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca> |
---|---|
date | Fri, 23 May 2008 14:16:54 -0400 |
parents | df3fae88ab46 |
children | e4473d9697d7 |
comparison
equal
deleted
inserted
replaced
221:58e17421c69c | 222:f6a7eb1b7970 |
---|---|
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 |