sakura.utils.distributions.rand_uniform
- sakura.utils.distributions.rand_uniform(batch_size, n_dim=2, low=-1.0, high=1.0, n_labels=1, label_offsets=None, label_indices=None) Tensor
Generates samples from a uniform distribution with optional label-based offsets.
When n_labels > 1, applies label-specific offsets to create separated clusters.
- Parameters:
batch_size (int) – Number of batch samples
n_dim (int, optional) – Number of latent dimension, defaults to 2
low (float, optional) – Lower bound of uniform distribution (for each dimension), defaults to -1.
high (float, optional) – Upper bound of uniform distribution (for each dimension), defaults to 1.
n_labels (int, optional) – Number of labels to consider in supervision, defaults to 1, where supervision is off
label_offsets (list[list[float]], optional) – Offsets for each label cluster
label_indices (list[int], optional) – List of label indices (0 <= index < n_labels) for each batch sample, randomly assigned if none provided
- Returns:
Tensor of shape (batch_size, n_dim) with uniform samples
- Return type:
torch.FloatTensor