RightShift

public final class RightShift

Elementwise computes the bitwise right-shift of `x` and `y`.

Performs a logical shift for unsigned integer types, and an arithmetic shift for signed integer types.

If `y` is negative, or greater than or equal to than the width of `x` in bits the result is implementation defined.

Example:

import tensorflow as tf
 from tensorflow.python.ops import bitwise_ops
 import numpy as np
 dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64]
 
 for dtype in dtype_list:
   lhs = tf.constant([-1, -5, -3, -14], dtype=dtype)
   rhs = tf.constant([5, 0, 7, 11], dtype=dtype)
 
   right_shift_result = bitwise_ops.right_shift(lhs, rhs)
 
   print(right_shift_result)
 
 # This will print:
 # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int8)
 # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int16)
 # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int32)
 # tf.Tensor([-1 -5 -1 -1], shape=(4,), dtype=int64)
 
 lhs = np.array([-2, 64, 101, 32], dtype=np.int8)
 rhs = np.array([-1, -5, -3, -14], dtype=np.int8)
 bitwise_ops.right_shift(lhs, rhs)
 # <tf.Tensor: shape=(4,), dtype=int8, numpy=array([ -2,  64, 101,  32], dtype=int8)>
 

Constants

String OP_NAME The name of this op, as known by TensorFlow core engine

Public Methods

Output<T>
asOutput()
Returns the symbolic handle of the tensor.
static <T extends TNumber> RightShift<T>
create(Scope scope, Operand<T> x, Operand<T> y)
Factory method to create a class wrapping a new RightShift operation.
Output<T>
z()

Inherited Methods

org.tensorflow.op.RawOp
final boolean
equals(Object obj)
final int
Operation
op()
Return this unit of computation as a single Operation.
final String
boolean
equals(Object arg0)
final Class<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()
org.tensorflow.op.Op
abstract ExecutionEnvironment
env()
Return the execution environment this op was created in.
abstract Operation
op()
Return this unit of computation as a single Operation.
org.tensorflow.Operand
abstract Output<T>
asOutput()
Returns the symbolic handle of the tensor.
abstract T
asTensor()
Returns the tensor at this operand.
abstract Shape
shape()
Returns the (possibly partially known) shape of the tensor referred to by the Output of this operand.
abstract Class<T>
type()
Returns the tensor type of this operand
org.tensorflow.ndarray.Shaped
abstract int
rank()
abstract Shape
shape()
abstract long
size()
Computes and returns the total size of this container, in number of values.

Constants

public static final String OP_NAME

The name of this op, as known by TensorFlow core engine

Constant Value: "RightShift"

Public Methods

public Output<T> asOutput ()

Returns the symbolic handle of the tensor.

Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is used to obtain a symbolic handle that represents the computation of the input.

public static RightShift<T> create (Scope scope, Operand<T> x, Operand<T> y)

Factory method to create a class wrapping a new RightShift operation.

Parameters
scope current scope
Returns
  • a new instance of RightShift

public Output<T> z ()