Files
DZGCoOp/Dassl.ProGrad.pytorch/dassl/modeling/ops/sequential2.py
T
Rain-BusandClaude Opus 4.7 5027694a2b release code
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-10-12 22:30:08 +08:00

16 lines
427 B
Python

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