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
Tensoror 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, ifdensityis a scalar, then each point in the mask will be sampled with probabilitydensity. A non-scalardensitymay be used to create variable-density sampling masks. tfmri.sampling.density_grid can be used to create density grids.seed – A
Tensorof shape[2]. The seed for the stateless RNG.seedandrngmay not be specified at the same time.rng – A
tf.random.Generator. The stateful RNG to use.seedandrngmay not be specified at the same time. If neitherseednorrngare 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
seedandrngare specified.