您当前的位置: 首页 >  pytorch

段智华

暂无认证

  • 0浏览

    0关注

    1232博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Pytorch 学习(6):Pytorch中的torch.nn Convolution Layers 卷积层参数初始化

段智华 发布时间:2018-09-10 21:27:42 ,浏览量:0

Pytorch 学习(6):Pytorch中的torch.nn  Convolution Layers  卷积层参数初始化

class Conv1d(_ConvNd):
	......
    def __init__(self, in_channels, out_channels, kernel_size, stride=1,
                 padding=0, dilation=1, groups=1, bias=True):
        kernel_size = _single(kernel_size)
        stride = _single(stride)
        padding = _single(padding)
        dilation = _single(dilation)
        super(Conv1d, self).__init__(
            in_channels, out_channels, kernel_size, stride, padding, dilation,
            False, _single(0), groups, bias)

    def forward(self, input):
        return F.conv1d(input, self.weight, self.bias, self.stride,
                        self.padding, self.dilation, self.groups)

参数初始化调用 _ntuple方法:

import collections
from itertools import repeat


def _ntuple(n):
    def parse(x):
        if isinstance(x, collections.Iterable):
      
关注
打赏
1659361485
查看更多评论
立即登录/注册

微信扫码登录

0.0413s