comparison nnet_ops.py @ 218:df3fae88ab46

small debugging
author Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca>
date Fri, 23 May 2008 12:22:54 -0400
parents 44dd9b6448c5
children f6a7eb1b7970
comparison
equal deleted inserted replaced
217:44dd9b6448c5 218:df3fae88ab46
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, node, name, (x,), (z,), sub): 47 def c_code(self, name, node, (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