Broadcast¶
- class continual.Broadcast(num_streams=None)[source]¶
Broadcast one input stream to multiple output streams.
This is needed for handling parallel streams in subsequent modules. For instance, here is how it is used to create a residual connection:
residual = co.Sequential( co.Broadcast(2), co.Parallel( co.Conv3d(32, 32, kernel_size=3, padding=1), co.Delay(2), ), co.Reduce("sum"), )
Since the
Broadcast
->Parallel
->Reduce
sequence is so common, identical behavior can be achieved withBroadcastReduce
residual = co.BroadcastReduce( co.Conv3d(32, 32, kernel_size=3, padding=1), co.Delay(2), reduce="sum" )
Even shorter, the library features a residual connection, which automatically handles delays:
residual = co.Residual(co.Conv3d(32, 32, kernel_size=3, padding=1))
- Parameters:
num_streams (int) – Number of streams to broadcast to. If none are given, a Sequential module may infer it automatically.