@gof.local_optimizer([T.mul])
def local_mul_zero(node):
 if (node.op == T.mul):
  otype = node.outputs[0].type
  for i in node.inputs:
   try:
    value = get_scalar_constant_value(i)
   except NotScalarConstantError:
    continue
   if (value == 0):
    return _fill_chain(theano._asarray(0, dtype=otype.dtype), node.inputs)

@ gof . local_optimizer ( [ T . mul ] ) def local_mul_zero ( node ) : if ( node . op == T . mul ) : otype = node . outputs [ 0 ] . type for i in node . inputs : try : value = get_scalar_constant_value ( i ) except NotScalarConstantError : continue if ( value == 0 ) : return _fill_chain ( theano . _asarray ( 0 , dtype = otype . dtype ) , node . inputs )
as part of canonicalization .