@register_opt('low_memory')
@local_optimizer([GpuCAReduceCuda])
def local_gpu_elemwise_careduce(node):
 if (isinstance(node.op, GpuCAReduceCuda) and (node.op.pre_scalar_op is None) and node.inputs[0].owner and isinstance(node.inputs[0].owner.op, GpuElemwise) and isinstance(node.inputs[0].owner.op.scalar_op, scalar.basic.Sqr)):
  op = node.op
  inp = node.inputs[0].owner.inputs[0]
  return [gpu_ca_reduce_cuda(scalar_op=op.scalar_op, axis=op.axis, reduce_mask=op.reduce_mask, pre_scalar_op=scalar.basic.sqr)(inp)]

@ register_opt ( 'low_memory' ) @ local_optimizer ( [ GpuCAReduceCuda ] ) def local_gpu_elemwise_careduce ( node ) : if ( isinstance ( node . op , GpuCAReduceCuda ) and ( node . op . pre_scalar_op is None ) and node . inputs [ 0 ] . owner and isinstance ( node . inputs [ 0 ] . owner . op , GpuElemwise ) and isinstance ( node . inputs [ 0 ] . owner . op . scalar_op , scalar . basic . Sqr ) ) : op = node . op inp = node . inputs [ 0 ] . owner . inputs [ 0 ] return [ gpu_ca_reduce_cuda ( scalar_op = op . scalar_op , axis = op . axis , reduce_mask = op . reduce_mask , pre_scalar_op = scalar . basic . sqr ) ( inp ) ]
merge some gpucareducecuda and gpuelemwise .