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> | |
Output<U> |
output()
The cast result with the same shape as the input.
|
Inherited Methods
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