pytorch torch.nn.Sequential(* args)(嘎哈用的?构建神经网络用的?)
生活随笔
收集整理的这篇文章主要介绍了
pytorch torch.nn.Sequential(* args)(嘎哈用的?构建神经网络用的?)
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
class torch.nn.Sequential(* args)
一个时序容器。Modules 会以他们传入的顺序被添加到容器中。当然,也可以传入一个OrderedDict。
为了更容易的理解如何使用Sequential, 下面给出了一个例子:
# Example of using Sequentialmodel = 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())]))参考文章:https://pytorch-cn.readthedocs.io/zh/latest/package_references/torch-nn/#class-torchnnsequential-args
总结
以上是生活随笔为你收集整理的pytorch torch.nn.Sequential(* args)(嘎哈用的?构建神经网络用的?)的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: pytorch nn.Linear(对输
- 下一篇: pytorch torch.nn.MSE