class torch.quasirandom.SobolEngine(dimension, scramble=False, seed=None)
[source]
The torch.quasirandom.SobolEngine
is an engine for generating (scrambled) Sobol sequences. Sobol sequences are an example of low discrepancy quasi-random sequences.
This implementation of an engine for Sobol sequences is capable of sampling sequences up to a maximum dimension of 1111. It uses direction numbers to generate these sequences, and these numbers have been adapted from here.
True
will produce scrambled Sobol sequences. Scrambling is capable of producing better Sobol sequences. Default: False
.None
Examples:
>>> soboleng = torch.quasirandom.SobolEngine(dimension=5) >>> soboleng.draw(3) tensor([[0.5000, 0.5000, 0.5000, 0.5000, 0.5000], [0.7500, 0.2500, 0.7500, 0.2500, 0.7500], [0.2500, 0.7500, 0.2500, 0.7500, 0.2500]])
draw(n=1, out=None, dtype=torch.float32)
[source]
Function to draw a sequence of n
points from a Sobol sequence. Note that the samples are dependent on the previous samples. The size of the result is .
torch.dtype
, optional) – the desired data type of the returned tensor. Default: torch.float32
fast_forward(n)
[source]
Function to fast-forward the state of the SobolEngine
by n
steps. This is equivalent to drawing n
samples without using the samples.
n (Int) – The number of steps to fast-forward by.
reset()
[source]
Function to reset the SobolEngine
to base state.
© 2019 Torch Contributors
Licensed under the 3-clause BSD License.
https://pytorch.org/docs/1.7.0/generated/torch.quasirandom.SobolEngine.html