Python chainer.links 模块,ConvolutionND() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用chainer.links.ConvolutionND()

项目:depccg    作者:masashi-y    | 项目源码 | 文件源码
def __init__(self, in_size, out_size, kernel_size=2, attention=False,
                 decoder=False):
        if kernel_size == 1:
            super(QRNNLayer, self).__init__(W=Linear(in_size, 3 * out_size))
        elif kernel_size == 2:
            super(QRNNLayer, self).__init__(W=Linear(in_size, 3 * out_size, nobias=True),
                             V=Linear(in_size, 3 * out_size))
        else:
            super(QRNNLayer, self).__init__(
                conv=L.ConvolutionND(1, in_size, 3 * out_size, kernel_size,
                                     stride=1, pad=kernel_size - 1))
        if attention:
            self.add_link('U', Linear(out_size, 3 * in_size))
            self.add_link('o', Linear(2 * out_size, out_size))
        self.in_size, self.size, self.attention = in_size, out_size, attention
        self.kernel_size = kernel_size
项目:NlpUtil    作者:trtd56    | 项目源码 | 文件源码
def __init__(self, in_size, out_size, kernel_size=2, attention=False,
                 decoder=False):
        if kernel_size == 1:
            super().__init__(W=Linear(in_size, 3 * out_size))
        elif kernel_size == 2:
            super().__init__(W=Linear(in_size, 3 * out_size, nobias=True),
                             V=Linear(in_size, 3 * out_size))
        else:
            super().__init__(
                conv=L.ConvolutionND(1, in_size, 3 * out_size, kernel_size,
                                     stride=1, pad=kernel_size - 1))
        if attention:
            self.add_link('U', Linear(out_size, 3 * in_size))
            self.add_link('o', Linear(2 * out_size, out_size))
        self.in_size, self.size, self.attention = in_size, out_size, attention
        self.kernel_size = kernel_size
项目:voxcelchain    作者:hiroaki-kaneda    | 项目源码 | 文件源码
def __init__(self):
        super(VoxelChain, self).__init__(
            conv1 = L.ConvolutionND(3,  1, 20, 5), # 1 input, 20 outputs, filter size 5 pixels
            conv2 = L.ConvolutionND(3, 20, 20, 5), # 20 inputs, 20 outputs, filter size 5 pixels
            fc3=L.Linear(2500, 1300),
            fc4=L.Linear(1300, 10),
        )
        self.train = True
项目:brain_segmentation    作者:Ryo-Ito    | 项目源码 | 文件源码
def __init__(self):
        init = chainer.initializers.HeNormal(scale=0.01)
        super(VoxResModule, self).__init__(
            bnorm1=L.BatchNormalization(size=64),
            conv1=L.ConvolutionND(3, 64, 64, 3, pad=1, initialW=init),
            bnorm2=L.BatchNormalization(size=64),
            conv2=L.ConvolutionND(3, 64, 64, 3, pad=1, initialW=init))
项目:brain_segmentation    作者:Ryo-Ito    | 项目源码 | 文件源码
def __init__(self, in_channels=1, n_classes=4):
        init = chainer.initializers.HeNormal(scale=0.01)
        super(VoxResNet, self).__init__(
            conv1a=L.ConvolutionND(3, in_channels, 32, 3, pad=1, initialW=init),
            bnorm1a=L.BatchNormalization(32),
            conv1b=L.ConvolutionND(3, 32, 32, 3, pad=1, initialW=init),
            bnorm1b=L.BatchNormalization(32),
            conv1c=L.ConvolutionND(3, 32, 64, 3, stride=2, pad=1, initialW=init),
            voxres2=VoxResModule(),
            voxres3=VoxResModule(),
            bnorm3=L.BatchNormalization(64),
            conv4=L.ConvolutionND(3, 64, 64, 3, stride=2, pad=1, initialW=init),
            voxres5=VoxResModule(),
            voxres6=VoxResModule(),
            bnorm6=L.BatchNormalization(64),
            conv7=L.ConvolutionND(3, 64, 64, 3, stride=2, pad=1, initialW=init),
            voxres8=VoxResModule(),
            voxres9=VoxResModule(),
            c1deconv=L.DeconvolutionND(3, 32, 32, 3, pad=1, initialW=init),
            c1conv=L.ConvolutionND(3, 32, n_classes, 3, pad=1, initialW=init),
            c2deconv=L.DeconvolutionND(3, 64, 64, 4, stride=2, pad=1, initialW=init),
            c2conv=L.ConvolutionND(3, 64, n_classes, 3, pad=1, initialW=init),
            c3deconv=L.DeconvolutionND(3, 64, 64, 6, stride=4, pad=1, initialW=init),
            c3conv=L.ConvolutionND(3, 64, n_classes, 3, pad=1, initialW=init),
            c4deconv=L.DeconvolutionND(3, 64, 64, 10, stride=8, pad=1, initialW=init),
            c4conv=L.ConvolutionND(3, 64, n_classes, 3, pad=1, initialW=init)
        )
项目:chainer-qrnn    作者:musyoku    | 项目源码 | 文件源码
def Convolution1D(in_channels, out_channels, ksize, stride=1, pad=0, initialW=None, weightnorm=False):
    if weightnorm:
        return WeightnormConvolution1D(in_channels, out_channels, ksize, stride=stride, pad=pad, initialV=initialW)
    return ConvolutionND(1, in_channels, out_channels, ksize, stride=stride, pad=pad, initialW=initialW)
项目:chainer-glu    作者:musyoku    | 项目源码 | 文件源码
def Convolution1D(in_channels, out_channels, ksize, stride=1, pad=0, initialW=None, weightnorm=False):
    if weightnorm:
        return WeightnormConvolution1D(in_channels, out_channels, ksize, stride=stride, pad=pad, initialV=initialW)
    return ConvolutionND(1, in_channels, out_channels, ksize, stride=stride, pad=pad, initialW=initialW)
项目:fontkaruta_classifier    作者:suga93    | 项目源码 | 文件源码
def __init__(self, n_classes):
        super(MiddleCNN, self).__init__()
        with self.init_scope():
            self.conv1 = L.ConvolutionND(2, 3, 16, 3, pad=1, initialW=init())
            self.bnorm1 = L.BatchNormalization(16)
            self.conv2 = L.ConvolutionND(2, 16, 16, 3, pad=1, initialW=init())
            self.bnorm2 = L.BatchNormalization(16)
            self.conv3 = L.ConvolutionND(2, 16, 32, 3, pad=1, initialW=init())
            self.bnorm3 = L.BatchNormalization(32)
            self.conv4 = L.ConvolutionND(2, 32, 32, 3, pad=1, initialW=init())
            self.bnorm4 = L.BatchNormalization(32)
            self.fc = L.Linear(None, n_classes)
项目:fontkaruta_classifier    作者:suga93    | 项目源码 | 文件源码
def __init__(self, n_classes):
        super(SimpleCNN, self).__init__()
        with self.init_scope():
            self.conv1 = L.ConvolutionND(2, 3, 32, 3, pad=1, initialW=init())
            self.bnorm1 = L.BatchNormalization(32)
            self.conv2 = L.ConvolutionND(2, 32, 64, 3, pad=1, initialW=init())
            self.bnorm2 = L.BatchNormalization(64)
            self.fc = L.Linear(None, n_classes)