Last updated: 2023-03-16.
tf_quant_finance.math.qmc.random_digital_shift#
Returns a Tensor drawn from a uniform distribution.
tf_quant_finance.math.qmc.random_digital_shift(
dim, num_digits, seed, validate_args=False, dtype=None, name=None
)
The result can be can be passed to the sample_digital_net function to shift
sampled points through a bitwise xor.
Examples#
import tf_quant_finance as tff
# Example: Creating a Digital shift which can randomize sampled 2D points.
dim = 2
num_digits = 10
seed = (2, 3)
tff.math.qmc.random_digital_shift(dim, num_digits, seed=seed)
# ==> tf.Tensor([586, 1011], shape=(2,), dtype=int32)
Args:#
dim: Positive scalarTensorof integers with rank 0. The event size of the sampled points to shift.num_digits: Positive scalarTensorof integers with rank 0. the base-2 precision of the sampled points to shift.seed: Positive scalarTensorwith shape [2] and dtypeint32used as seed for the random generator.validate_args: Pythonboolindicating whether to validate arguments. Default value:False.dtype: Optionaldtype. Thedtypeof the outputTensor(eithertf.int32ortf.int64). Default value:Nonewhich maps totf.int32.name: Pythonstrname prefixed to ops created by this function. Default value:Nonewhich maps torandom_digital_shift.
Returns:#
A Tensor with shape (dim,).