Parallel¶
- class continual.Parallel(*args: CoModule, auto_delay=True)[source]¶
- class continual.Parallel(arg: OrderedDict[str, CoModule], auto_delay=True)
Container for executing modules in parallel. Modules will be added to it in the order they are passed in the constructor.
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->Reducesequence is so common, identical behavior can be achieved withBroadcastReduceresidual = 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))