Delay¶
- class continual.Delay(delay, temporal_fill='zeros', auto_shrink=False)[source]¶
Delay an input by a number of steps.
This module only introduces a delay in the continual modes, i.e. on
forward_step
andforward_steps
. In essence it caches the input fordelay
steps before outputting it again.The
Delay
modules is used extensively in various container modules to align delays of different computational branches. For instance, it is used to align theResidual
module as shown in the example below.- Parameters:
delay (int) – The number of steps to delay an output.
temporal_fill (PaddingMode) – Temporal state initialisation mode (“zeros” or “replicate”)
auto_shrink (Union[bool, str]) – Whether to shrink the temporal dimension of the feature map during forward. This module is handy for residuals that are parallel to modules which reduce the number of temporal steps. Options: “centered” or True: Centered residual shrink; “lagging”: lagging shrink.
Examples:
conv = co.Conv3d(32, 32, kernel_size=3, padding=1) residual = co.BroadcastReduce(conv, co.Delay(2), reduce="sum")