release code
This commit is contained in:
15
Dassl.ProGrad.pytorch/dassl/modeling/ops/sequential2.py
Normal file
15
Dassl.ProGrad.pytorch/dassl/modeling/ops/sequential2.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import torch.nn as nn
|
||||
|
||||
|
||||
class Sequential2(nn.Sequential):
|
||||
"""An alternative sequential container to nn.Sequential,
|
||||
which accepts an arbitrary number of input arguments.
|
||||
"""
|
||||
|
||||
def forward(self, *inputs):
|
||||
for module in self._modules.values():
|
||||
if isinstance(inputs, tuple):
|
||||
inputs = module(*inputs)
|
||||
else:
|
||||
inputs = module(inputs)
|
||||
return inputs
|
||||
Reference in New Issue
Block a user