@register_opt()
@local_optimizer([GpuFromHost])
def local_gpu_elemwise_1(node):
 if isinstance(node.op, GpuFromHost):
  (host_i,) = node.inputs
  if (host_i.owner and isinstance(host_i.owner.op, tensor.Elemwise) and (len(host_i.owner.outputs) == 1) and (len(host_i.clients) == 1) and dtype_in_elemwise_supported(node.op)):
   elemwise_node = host_i.owner
   if isinstance(elemwise_node.op.scalar_op, Erfinv):
    new_op = GpuElemwise(erfinv_gpu)
   elif isinstance(elemwise_node.op.scalar_op, Erfcx):
    new_op = GpuElemwise(erfcx_gpu)
   else:
    try:
     new_op = GpuElemwise(elemwise_node.op.scalar_op)
    except SupportCodeError:
     return False
   if all([(i.dtype == 'float32') for i in elemwise_node.inputs]):
    gpu_elemwise = new_op(*[as_cuda_ndarray_variable(i) for i in elemwise_node.inputs])
    gpu_elemwise = split_huge_add_or_mul(gpu_elemwise.owner)
    if (not gpu_elemwise):
     return False
    return [gpu_elemwise.outputs[0]]
 return False

@ register_opt ( ) @ local_optimizer ( [ GpuFromHost ] ) def local_gpu_elemwise_1 ( node ) : if isinstance ( node . op , GpuFromHost ) : ( host_i , ) = node . inputs if ( host_i . owner and isinstance ( host_i . owner . op , tensor . Elemwise ) and ( len ( host_i . owner . outputs ) == 1 ) and ( len ( host_i . clients ) == 1 ) and dtype_in_elemwise_supported ( node . op ) ) : elemwise_node = host_i . owner if isinstance ( elemwise_node . op . scalar_op , Erfinv ) : new_op = GpuElemwise ( erfinv_gpu ) elif isinstance ( elemwise_node . op . scalar_op , Erfcx ) : new_op = GpuElemwise ( erfcx_gpu ) else : try : new_op = GpuElemwise ( elemwise_node . op . scalar_op ) except SupportCodeError : return False if all ( [ ( i . dtype == 'float32' ) for i in elemwise_node . inputs ] ) : gpu_elemwise = new_op ( * [ as_cuda_ndarray_variable ( i ) for i in elemwise_node . inputs ] ) gpu_elemwise = split_huge_add_or_mul ( gpu_elemwise . owner ) if ( not gpu_elemwise ) : return False return [ gpu_elemwise . outputs [ 0 ] ] return False
gpu_from_host) -> gpuelemwise(gpu_from_host) .