StochasticCastToInt

public final class StochasticCastToInt

Stochastically cast a given tensor from floats to ints.

The values are cast with a deterministic pseudo-random tensor from a uniform distribution generated from user given key, counter, algorithm. Values will saturate if out of the specified integer type range, and will become zero if inputs are NaN.

The outputs are a deterministic function of `input`, `key`, `counter`, `alg`.

Public Methods

Output<U>
asOutput()
Returns the symbolic handle of a tensor.
static <U extends Number, T extends Number> StochasticCastToInt<U>
create(Scope scope, Operand<T> input, Operand<?> key, Operand<?> counter, Operand<Integer> alg, Class<U> Tout)
Factory method to create a class wrapping a new StochasticCastToInt operation.
Output<U>
output()
The cast result with the same shape as the input.

Inherited Methods

org.tensorflow.op.PrimitiveOp
final boolean
equals(Object obj)
final int
Operation
op()
Returns the underlying 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.Operand
abstract Output<U extends Number>
asOutput()
Returns the symbolic handle of a tensor.

Public Methods

public Output<U> asOutput ()

Returns the symbolic handle of a 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 StochasticCastToInt<U> create (Scope scope, Operand<T> input, Operand<?> key, Operand<?> counter, Operand<Integer> alg, Class<U> Tout)

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

Parameters
scope current scope
input The operand to stochastically cast to int.
key Key for the counter-based RNG algorithm (shape uint64[1]).
counter Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used.
alg The RNG algorithm (shape int32[]).
Tout The type of the output.
Returns
  • a new instance of StochasticCastToInt

public Output<U> output ()

The cast result with the same shape as the input.