conditional_residual_block
conditional_residual_block
¶
Conditional Residual Block 1D Module originally used in the Diffusion Policy U-Net architecture.
ConditionalResidualBlock1D
¶
ConditionalResidualBlock1D(input_channels, output_channels, condition_dimension, kernel_size=3, num_groups=8, condition_predict_scale=False)
Bases: Module
Conditioned residual block for 1D diffusion-policy feature maps.
Initialize the conditioned residual block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_channels
|
int
|
Number of input channels. |
required |
output_channels
|
int
|
Number of output channels. |
required |
condition_dimension
|
int
|
Dimension of the conditioning vector. |
required |
kernel_size
|
int
|
Convolution kernel size. |
3
|
num_groups
|
int
|
Number of groups used by Conv1dBlock normalization. |
8
|
condition_predict_scale
|
bool
|
Whether conditioning predicts both scale and shift instead of scale only. |
False
|
Source code in src/versatil/models/layers/modulation/conditional_residual_block.py
forward
¶
Forward pass of ConditionalResidualBlock1D.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Input tensor of shape |
required |
condition
|
Tensor
|
Conditioning tensor of shape |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Output tensor of shape |