pytorch torch.nn.Sequential(* args)(嘎哈用的?构建神经网络用的?)
生活随笔
收集整理的這篇文章主要介紹了
pytorch torch.nn.Sequential(* args)(嘎哈用的?构建神经网络用的?)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
class torch.nn.Sequential(* args)
一個時序容器。Modules 會以他們傳入的順序被添加到容器中。當(dāng)然,也可以傳入一個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
總結(jié)
以上是生活随笔為你收集整理的pytorch torch.nn.Sequential(* args)(嘎哈用的?构建神经网络用的?)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: pytorch nn.Linear(对输
- 下一篇: pytorch torch.nn.MSE