@gof.local_optimizer([sigmoid])
def local_ultra_fast_sigmoid(node):
 if (isinstance(node.op, tensor.Elemwise) and (node.op.scalar_op == scalar_sigmoid)):
  out = ultra_fast_sigmoid(node.inputs[0])
  copy_stack_trace(node.outputs[0], out)
  def values_eq_approx_remove_low_prec(a, b):
   return tensor.TensorType.values_eq_approx(a, b, atol=0.02)
  out.tag.values_eq_approx = values_eq_approx_remove_low_prec
  return [out]

@ gof . local_optimizer ( [ sigmoid ] ) def local_ultra_fast_sigmoid ( node ) : if ( isinstance ( node . op , tensor . Elemwise ) and ( node . op . scalar_op == scalar_sigmoid ) ) : out = ultra_fast_sigmoid ( node . inputs [ 0 ] ) copy_stack_trace ( node . outputs [ 0 ] , out ) def values_eq_approx_remove_low_prec ( a , b ) : return tensor . TensorType . values_eq_approx ( a , b , atol = 0.02 ) out . tag . values_eq_approx = values_eq_approx_remove_low_prec return [ out ]
when enabled .