@register_opt('fast_compile')
@local_optimizer([tensor.Alloc])
def local_gpua_alloc2(node):
 try:
  get_context(None)
 except ContextNotDefined:
  return
 if (isinstance(node.op, tensor.Alloc) and all((((c != 'output') and isinstance(c.op, tensor.Join) and all(((i.owner and (i.owner.op in [host_from_gpu, tensor.alloc])) for i in c.inputs[1:]))) for (c, idx) in node.outputs[0].clients))):
  return [host_from_gpu(gpu_alloc(None)(*node.inputs))]

@ register_opt ( 'fast_compile' ) @ local_optimizer ( [ tensor . Alloc ] ) def local_gpua_alloc2 ( node ) : try : get_context ( None ) except ContextNotDefined : return if ( isinstance ( node . op , tensor . Alloc ) and all ( ( ( ( c != 'output' ) and isinstance ( c . op , tensor . Join ) and all ( ( ( i . owner and ( i . owner . op in [ host_from_gpu , tensor . alloc ] ) ) for i in c . inputs [ 1 : ] ) ) ) for ( c , idx ) in node . outputs [ 0 ] . clients ) ) ) : return [ host_from_gpu ( gpu_alloc ( None ) ( * node . inputs ) ) ]
join -> join moves an alloc that is an input to join to the gpu .