Harmonic
LinearHarmonicPrior
Bases: PriorDistribution
A subclass representing a Linear Harmonic prior distribution from Jit et al. https://arxiv.org/abs/2304.02198.
Source code in bionemo/moco/distributions/prior/continuous/harmonic.py
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
__init__(distance=3.8, length=None, center=False, rng_generator=None, device='cpu')
Linear Harmonic prior distribution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
distance
|
Float
|
RMS distance between adjacent points in the line graph. |
3.8
|
length
|
Optional[int]
|
The number of points in a batch. |
None
|
center
|
bool
|
Whether to center the samples around the mean. Defaults to False. |
False
|
rng_generator
|
Optional[Generator]
|
An optional :class: |
None
|
device
|
Optional[str]
|
Device to place the schedule on (default is "cpu"). |
'cpu'
|
Source code in bionemo/moco/distributions/prior/continuous/harmonic.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
sample(shape, mask=None, device='cpu', rng_generator=None)
Generates a specified number of samples from the Harmonic prior distribution.
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/continuous/harmonic.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|