搜索
您的当前位置:首页正文

pytorch系列7 -----nn.Sequential讲解

来源:吉趣旅游网

接下来想讲一下参数初始化方式对训练的影响,但是必须要涉及到pytorch的自定义参数初始化,然而参数初始化又包括在不同结构定义中初始化方式,因而先讲一下pytorch中的nn.Sequential

nn.Sequential

A sequential container. Modules will be added to it in the order they are passed in the constructor. Alternatively, an ordered dict of modules can also be passed in.

一个有序的容器,神经网络模块将按照在传入构造器的顺序依次被添加到计算图中执行,同时以神经网络模块为元素的有序字典也可以作为传入参数。

看一下例子:

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

因篇幅问题不能全部显示,请点此查看更多更全内容

Top