Class SDBitwise


  • public class SDBitwise
    extends SDOps
    • Constructor Detail

      • SDBitwise

        public SDBitwise​(SameDiff sameDiff)
    • Method Detail

      • and

        public SDVariable and​(SDVariable x,
                              SDVariable y)
        Bitwise AND operation. Supports broadcasting.
        Inputs must satisfy the following constraints:
        Must be same types: isSameType(x, y)
        Must have broadcastable shapes: isBroadcastableShapes(x, y)
        Parameters:
        x - First input array (INT type)
        y - Second input array (INT type)
        Returns:
        output Bitwise AND array (INT type)
      • and

        public SDVariable and​(String name,
                              SDVariable x,
                              SDVariable y)
        Bitwise AND operation. Supports broadcasting.
        Inputs must satisfy the following constraints:
        Must be same types: isSameType(x, y)
        Must have broadcastable shapes: isBroadcastableShapes(x, y)
        Parameters:
        name - name May be null. Name for the output variable
        x - First input array (INT type)
        y - Second input array (INT type)
        Returns:
        output Bitwise AND array (INT type)
      • bitRotl

        public SDVariable bitRotl​(SDVariable x,
                                  SDVariable shift)
        Roll integer bits to the left, i.e. var << 4 | var >> (32 - 4)
        Parameters:
        x - Input 1 (INT type)
        shift - Number of bits to shift. (INT type)
        Returns:
        output SDVariable with shifted bits (INT type)
      • bitRotl

        public SDVariable bitRotl​(String name,
                                  SDVariable x,
                                  SDVariable shift)
        Roll integer bits to the left, i.e. var << 4 | var >> (32 - 4)
        Parameters:
        name - name May be null. Name for the output variable
        x - Input 1 (INT type)
        shift - Number of bits to shift. (INT type)
        Returns:
        output SDVariable with shifted bits (INT type)
      • bitRotr

        public SDVariable bitRotr​(SDVariable x,
                                  SDVariable shift)
        Roll integer bits to the right, i.e. var >> 4 | var << (32 - 4)
        Parameters:
        x - Input 1 (INT type)
        shift - Number of bits to shift. (INT type)
        Returns:
        output SDVariable with shifted bits (INT type)
      • bitRotr

        public SDVariable bitRotr​(String name,
                                  SDVariable x,
                                  SDVariable shift)
        Roll integer bits to the right, i.e. var >> 4 | var << (32 - 4)
        Parameters:
        name - name May be null. Name for the output variable
        x - Input 1 (INT type)
        shift - Number of bits to shift. (INT type)
        Returns:
        output SDVariable with shifted bits (INT type)
      • bitShift

        public SDVariable bitShift​(SDVariable x,
                                   SDVariable shift)
        Shift integer bits to the left, i.e. var << 4
        Parameters:
        x - Input 1 (INT type)
        shift - Number of bits to shift. (INT type)
        Returns:
        output SDVariable with shifted bits (INT type)
      • bitShift

        public SDVariable bitShift​(String name,
                                   SDVariable x,
                                   SDVariable shift)
        Shift integer bits to the left, i.e. var << 4
        Parameters:
        name - name May be null. Name for the output variable
        x - Input 1 (INT type)
        shift - Number of bits to shift. (INT type)
        Returns:
        output SDVariable with shifted bits (INT type)
      • bitShiftRight

        public SDVariable bitShiftRight​(SDVariable x,
                                        SDVariable shift)
        Shift integer bits to the right, i.e. var >> 4
        Parameters:
        x - Input 1 (INT type)
        shift - Number of bits to shift. (INT type)
        Returns:
        output SDVariable with shifted bits (INT type)
      • bitShiftRight

        public SDVariable bitShiftRight​(String name,
                                        SDVariable x,
                                        SDVariable shift)
        Shift integer bits to the right, i.e. var >> 4
        Parameters:
        name - name May be null. Name for the output variable
        x - Input 1 (INT type)
        shift - Number of bits to shift. (INT type)
        Returns:
        output SDVariable with shifted bits (INT type)
      • bitsHammingDistance

        public SDVariable bitsHammingDistance​(SDVariable x,
                                              SDVariable y)
        Bitwise Hamming distance reduction over all elements of both input arrays.
        For example, if x=01100000 and y=1010000 then the bitwise Hamming distance is 2 (due to differences at positions 0 and 1)
        Inputs must satisfy the following constraints:
        Must be same types: isSameType(x, y)
        Parameters:
        x - First input array. (INT type)
        y - Second input array. (INT type)
        Returns:
        output bitwise Hamming distance (INT type)
      • bitsHammingDistance

        public SDVariable bitsHammingDistance​(String name,
                                              SDVariable x,
                                              SDVariable y)
        Bitwise Hamming distance reduction over all elements of both input arrays.
        For example, if x=01100000 and y=1010000 then the bitwise Hamming distance is 2 (due to differences at positions 0 and 1)
        Inputs must satisfy the following constraints:
        Must be same types: isSameType(x, y)
        Parameters:
        name - name May be null. Name for the output variable
        x - First input array. (INT type)
        y - Second input array. (INT type)
        Returns:
        output bitwise Hamming distance (INT type)
      • leftShift

        public SDVariable leftShift​(SDVariable x,
                                    SDVariable y)
        Bitwise left shift operation. Supports broadcasting.
        Parameters:
        x - Input to be bit shifted (INT type)
        y - Amount to shift elements of x array (INT type)
        Returns:
        output Bitwise shifted input x (INT type)
      • leftShift

        public SDVariable leftShift​(String name,
                                    SDVariable x,
                                    SDVariable y)
        Bitwise left shift operation. Supports broadcasting.
        Parameters:
        name - name May be null. Name for the output variable
        x - Input to be bit shifted (INT type)
        y - Amount to shift elements of x array (INT type)
        Returns:
        output Bitwise shifted input x (INT type)
      • leftShiftCyclic

        public SDVariable leftShiftCyclic​(SDVariable x,
                                          SDVariable y)
        Bitwise left cyclical shift operation. Supports broadcasting.
        Unlike #leftShift(INDArray, INDArray) the bits will "wrap around":
        leftShiftCyclic(01110000, 2) -> 11000001
        Parameters:
        x - Input to be bit shifted (INT type)
        y - Amount to shift elements of x array (INT type)
        Returns:
        output Bitwise cyclic shifted input x (INT type)
      • leftShiftCyclic

        public SDVariable leftShiftCyclic​(String name,
                                          SDVariable x,
                                          SDVariable y)
        Bitwise left cyclical shift operation. Supports broadcasting.
        Unlike #leftShift(INDArray, INDArray) the bits will "wrap around":
        leftShiftCyclic(01110000, 2) -> 11000001
        Parameters:
        name - name May be null. Name for the output variable
        x - Input to be bit shifted (INT type)
        y - Amount to shift elements of x array (INT type)
        Returns:
        output Bitwise cyclic shifted input x (INT type)
      • or

        public SDVariable or​(SDVariable x,
                             SDVariable y)
        Bitwise OR operation. Supports broadcasting.
        Inputs must satisfy the following constraints:
        Must be same types: isSameType(x, y)
        Must have broadcastable shapes: isBroadcastableShapes(x, y)
        Parameters:
        x - First input array (INT type)
        y - First input array (INT type)
        Returns:
        output Bitwise OR array (INT type)
      • or

        public SDVariable or​(String name,
                             SDVariable x,
                             SDVariable y)
        Bitwise OR operation. Supports broadcasting.
        Inputs must satisfy the following constraints:
        Must be same types: isSameType(x, y)
        Must have broadcastable shapes: isBroadcastableShapes(x, y)
        Parameters:
        name - name May be null. Name for the output variable
        x - First input array (INT type)
        y - First input array (INT type)
        Returns:
        output Bitwise OR array (INT type)
      • rightShift

        public SDVariable rightShift​(SDVariable x,
                                     SDVariable y)
        Bitwise right shift operation. Supports broadcasting.
        Parameters:
        x - Input to be bit shifted (INT type)
        y - Amount to shift elements of x array (INT type)
        Returns:
        output Bitwise shifted input x (INT type)
      • rightShift

        public SDVariable rightShift​(String name,
                                     SDVariable x,
                                     SDVariable y)
        Bitwise right shift operation. Supports broadcasting.
        Parameters:
        name - name May be null. Name for the output variable
        x - Input to be bit shifted (INT type)
        y - Amount to shift elements of x array (INT type)
        Returns:
        output Bitwise shifted input x (INT type)
      • rightShiftCyclic

        public SDVariable rightShiftCyclic​(SDVariable x,
                                           SDVariable y)
        Bitwise right cyclical shift operation. Supports broadcasting.
        Unlike rightShift(INDArray, INDArray) the bits will "wrap around":
        rightShiftCyclic(00001110, 2) -> 10000011
        Parameters:
        x - Input to be bit shifted (INT type)
        y - Amount to shift elements of x array (INT type)
        Returns:
        output Bitwise cyclic shifted input x (INT type)
      • rightShiftCyclic

        public SDVariable rightShiftCyclic​(String name,
                                           SDVariable x,
                                           SDVariable y)
        Bitwise right cyclical shift operation. Supports broadcasting.
        Unlike rightShift(INDArray, INDArray) the bits will "wrap around":
        rightShiftCyclic(00001110, 2) -> 10000011
        Parameters:
        name - name May be null. Name for the output variable
        x - Input to be bit shifted (INT type)
        y - Amount to shift elements of x array (INT type)
        Returns:
        output Bitwise cyclic shifted input x (INT type)
      • xor

        public SDVariable xor​(SDVariable x,
                              SDVariable y)
        Bitwise XOR operation (exclusive OR). Supports broadcasting.
        Inputs must satisfy the following constraints:
        Must be same types: isSameType(x, y)
        Must have broadcastable shapes: isBroadcastableShapes(x, y)
        Parameters:
        x - First input array (INT type)
        y - First input array (INT type)
        Returns:
        output Bitwise XOR array (INT type)
      • xor

        public SDVariable xor​(String name,
                              SDVariable x,
                              SDVariable y)
        Bitwise XOR operation (exclusive OR). Supports broadcasting.
        Inputs must satisfy the following constraints:
        Must be same types: isSameType(x, y)
        Must have broadcastable shapes: isBroadcastableShapes(x, y)
        Parameters:
        name - name May be null. Name for the output variable
        x - First input array (INT type)
        y - First input array (INT type)
        Returns:
        output Bitwise XOR array (INT type)