(self, ary, shift_ary, value=True, out=None)
return out
Shifts input array

        Arguments:
            ary: tensor
            shift_ary: tensor of shift amount
            out: reference to output
Shifts input array
Shifts input array
def shift(self, ary, shift_ary, value=True, out=None):
        """
        Shifts input array

        Arguments:
            ary: tensor
            shift_ary: tensor of shift amount
            out: reference to output
        """
        if not hasattr(ary, 'shape'):
            ary = self.array(np.array(ary))

        if not hasattr(shift_ary, 'shape'):
            shift_ary = self.array(np.array(shift_ary))

        if out is None:
            out = self.empty_like(ary)

        blocks = lambda x: max(int(math.ceil(x)), 1)

        shift_kernel = binary.shift()
        SHIFT_BLOCK_SIZE = 64
        sizeary = ary.shape[0] * ary.shape[1]
        shift_params = [
            (blocks(sizeary/SHIFT_BLOCK_SIZE), 1),
            (SHIFT_BLOCK_SIZE, 1, 1),
            self.stream,
            ary.gpudata, shift_ary.gpudata, out.gpudata, value, sizeary, shift_ary.shape[0], shift_ary.shape[1]
        ]
        shift_kernel.prepared_async_call(*shift_params)

        return out
def shift ( self , ary , shift_ary , value = True , out = None ) : if not hasattr ( ary , 'shape' ) : ary = self . array ( np . array ( ary ) ) if not hasattr ( shift_ary , 'shape' ) : shift_ary = self . array ( np . array ( shift_ary ) ) if out is None : out = self . empty_like ( ary ) blocks = lambda x : max ( int ( math . ceil ( x ) ) , 1 ) shift_kernel = binary . shift ( ) SHIFT_BLOCK_SIZE = 64 sizeary = ary . shape [ 0 ] * ary . shape [ 1 ] shift_params = [ ( blocks ( sizeary / SHIFT_BLOCK_SIZE ) , 1 ) , ( SHIFT_BLOCK_SIZE , 1 , 1 ) , self . stream , ary . gpudata , shift_ary . gpudata , out . gpudata , value , sizeary , shift_ary . shape [ 0 ] , shift_ary . shape [ 1 ] ] shift_kernel . prepared_async_call ( * shift_params ) return out