Shortcuts

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 -> Reduce sequence is so common, identical behavior can be achieved with BroadcastReduce

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:
  • arg (OrderedDict[str, CoModule]) – An OrderedDict of strings and modules.

  • *args (CoModule) – Comma-separated modules.

  • auto_delay (bool, optional) – Automatically add delay to modules in order to match the longest delay. Defaults to True.

Read the Docs v: latest
Versions
latest
stable
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.