@register_specialize
@register_stabilize
@gof.local_optimizer([T.fill])
def local_fill_to_alloc(node):
 if (node.op == T.fill):
  (r, v) = node.inputs
  if (v.type == node.outputs[0].type):
   rval = [v]
  elif (v.type.broadcastable == node.outputs[0].type.broadcastable):
   rval = [T.cast(v, node.outputs[0].type.dtype)]
  elif (r.type.broadcastable == node.outputs[0].type.broadcastable):
   o = broadcast_like(v, r, node.fgraph, dtype=v.dtype)
   copy_stack_trace(node.outputs[0], o)
   rval = [o]
  else:
   return
  assert (rval[0].type == node.outputs[0].type), ('rval', rval[0].type, 'orig', node.outputs[0].type, 'node', node)
  return rval

@ register_specialize @ register_stabilize @ gof . local_optimizer ( [ T . fill ] ) def local_fill_to_alloc ( node ) : if ( node . op == T . fill ) : ( r , v ) = node . inputs if ( v . type == node . outputs [ 0 ] . type ) : rval = [ v ] elif ( v . type . broadcastable == node . outputs [ 0 ] . type . broadcastable ) : rval = [ T . cast ( v , node . outputs [ 0 ] . type . dtype ) ] elif ( r . type . broadcastable == node . outputs [ 0 ] . type . broadcastable ) : o = broadcast_like ( v , r , node . fgraph , dtype = v . dtype ) copy_stack_trace ( node . outputs [ 0 ] , o ) rval = [ o ] else : return assert ( rval [ 0 ] . type == node . outputs [ 0 ] . type ) , ( 'rval' , rval [ 0 ] . type , 'orig' , node . outputs [ 0 ] . type , 'node' , node ) return rval
fill -> alloc(v .