- class mmcv.ops.SparseSequential(*args, **kwargs)¶
A sequential container. Modules will be added to it in the order they are passed in the constructor. Alternatively, an ordered dict of modules can also be passed in.
To make it easier to understand, given is a small example:
.. rubric:: Example
>>> # using Sequential: >>> from mmcv.ops import SparseSequential >>> model = SparseSequential( SparseConv2d(1,20,5), nn.ReLU(), SparseConv2d(20,64,5), nn.ReLU() )
>>> # using Sequential with OrderedDict >>> model = SparseSequential(OrderedDict([ ('conv1', SparseConv2d(1,20,5)), ('relu1', nn.ReLU()), ('conv2', SparseConv2d(20,64,5)), ('relu2', nn.ReLU()) ]))
>>> # using Sequential with kwargs(python 3.6+) >>> model = SparseSequential( conv1=SparseConv2d(1,20,5), relu1=nn.ReLU(), conv2=SparseConv2d(20,64,5), relu2=nn.ReLU() )
- forward(input: torch.Tensor) → torch.Tensor¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.