<s> import theano <EOL> import theano . tensor <EOL> class ScalarSoftsign ( theano . scalar . UnaryScalarOp ) : <EOL> @ staticmethod <EOL> def static_impl ( x ) : <EOL> return x / ( <NUM_LIT:1.0> + abs ( x ) ) <EOL> def impl ( self , x ) : <EOL> return ScalarSoftsign . static_impl ( x ) <EOL> def grad ( self , inp , grads ) : <EOL> x , = inp <EOL> gz , = grads <EOL> if '<STR_LIT:float>' in x . type . dtype : <EOL> d = ( <NUM_LIT:1.0> + abs ( x ) ) <EOL> return [ gz / ( d * d ) ] <EOL> else : <EOL> return NotImplemented <EOL> def c_code ( self , node , name , inp , out , sub ) : <EOL> x , = inp <EOL> z , = out <EOL> if node . inputs [ <NUM_LIT:0> ] . type in [ theano . scalar . float32 , <EOL> theano . scalar . float64 ] : <EOL> return "<STR_LIT>" % locals ( ) <EOL> raise NotImplementedError ( '<STR_LIT>' ) <EOL> scalar_softsign = ScalarSoftsign ( theano . scalar . upgrade_to_float , <EOL> name = '<STR_LIT>' ) <EOL> softsign = theano . tensor . Elemwise ( scalar_softsign , name = '<STR_LIT>' ) </s>
