pytorch torch.nn.Sequential(*args: Any)

# Example of using Sequential
model = nn.Sequential(
          nn.Conv2d(1,20,5),
          nn.ReLU(),
          nn.Conv2d(20,64,5),
          nn.ReLU()
        )

# Example of using Sequential with OrderedDict
model = nn.Sequential(OrderedDict([
          ('conv1', nn.Conv2d(1,20,5)),
          ('relu1', nn.ReLU()),
          ('conv2', nn.Conv2d(20,64,5)),
          ('relu2', nn.ReLU())
        ]))

API

CLASS torch.nn.Sequential(*args: Any)

参考:
https://pytorch.org/docs/stable/generated/torch.nn.Sequential.html#torch.nn.Sequential

你可能感兴趣的:(Python,python)