Ejemplo n.º 1
0
 def __init__(self, scalar_op, axis=None, dtype=None, acc_dtype=None):
     if not hasattr(scalar_op, 'identity'):
         raise ValueError("No identity on scalar op")
     CAReduceDtype.__init__(self,
                            scalar_op,
                            axis=axis,
                            dtype=dtype,
                            acc_dtype=acc_dtype)
Ejemplo n.º 2
0
    def make_node(self, input):
        res = CAReduceDtype.make_node(self, input)
        input = as_gpuarray_variable(input)
        otype = GpuArrayType(dtype=res.outputs[0].dtype,
                             broadcastable=res.outputs[0].broadcastable)

        if res.op.axis is not None:
            redux = []
            for i in range(len(input.type.broadcastable)):
                redux.append(i in res.op.axis)
                # since redux is just another way to describe what is in axis
                # it doesn't need to be compared in __eq__ or __hash__
            res.op.redux = redux

        return Apply(res.op, [input], [otype()])
Ejemplo n.º 3
0
    def make_node(self, input):
        res = CAReduceDtype.make_node(self, input)
        input = as_gpuarray_variable(input)
        otype = GpuArrayType(dtype=res.outputs[0].dtype,
                             broadcastable=res.outputs[0].broadcastable)

        if res.op.axis is not None:
            redux = []
            for i in range(len(input.type.broadcastable)):
                redux.append(i in res.op.axis)
                # since redux is just another way to describe what is in axis
                # it doesn't need to be compared in __eq__ or __hash__
            res.op.redux = redux

        return Apply(res.op, [input], [otype()])
Ejemplo n.º 4
0
 def __init__(self, scalar_op, axis=None, dtype=None, acc_dtype=None):
     if not hasattr(scalar_op, 'identity'):
         raise ValueError("No identity on scalar op")
     CAReduceDtype.__init__(self, scalar_op, axis=axis, dtype=dtype,
                            acc_dtype=acc_dtype)