tfmri.sampling.random_mask
tfmri.sampling.random_mask¶
- random_mask(shape, density=1.0, seed=None, rng=None, name=None)[source]¶
Returns a random sampling mask with the given density.
- Parameters
shape – A 1D integer
Tensor
or array. The shape of the output mask.density – A
Tensor
. A density grid. After broadcasting withshape
, each point in the grid represents the probability that a given point will be sampled. For example, ifdensity
is a scalar, then each point in the mask will be sampled with probabilitydensity
. A non-scalardensity
may be used to create variable-density sampling masks. tfmri.sampling.density_grid can be used to create density grids.seed – A
Tensor
of shape[2]
. The seed for the stateless RNG.seed
andrng
may not be specified at the same time.rng – A
tf.random.Generator
. The stateful RNG to use.seed
andrng
may not be specified at the same time. If neitherseed
norrng
are provided, the global RNG will be used.name – A name for this op.
- Returns
A boolean tensor containing the sampling mask.
- Raises
ValueError – If both
seed
andrng
are specified.