Uniform
DiscreteUniformPrior
Bases: DiscretePriorDistribution
A subclass representing a discrete uniform prior distribution.
Source code in bionemo/moco/distributions/prior/discrete/uniform.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
__init__(num_classes=10)
Initializes a discrete uniform prior distribution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_classes
|
int
|
The number of classes in the discrete uniform distribution. Defaults to 10. |
10
|
Source code in bionemo/moco/distributions/prior/discrete/uniform.py
28 29 30 31 32 33 34 35 36 37 |
|
sample(shape, mask=None, device='cpu', rng_generator=None)
Generates a specified number of samples.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shape
|
Tuple
|
The shape of the samples to generate. |
required |
device
|
str
|
cpu or gpu. |
'cpu'
|
mask
|
Optional[Tensor]
|
An optional mask to apply to the samples. Defaults to None. |
None
|
rng_generator
|
Optional[Generator]
|
An optional :class: |
None
|
Returns:
Name | Type | Description |
---|---|---|
Float |
Tensor
|
A tensor of samples. |
Source code in bionemo/moco/distributions/prior/discrete/uniform.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|