Python chainer.links.DeconvolutionND() Examples
The following are 8
code examples of chainer.links.DeconvolutionND().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
chainer.links
, or try the search function
.
Example #1
Source File: module.py From fpl with MIT License | 5 votes |
def __init__(self, nb_inputs, channel_list, ksize_list, no_act_last=False): super(Decoder, self).__init__() self.nb_layers = len(channel_list) self.no_act_last = no_act_last channel_list = channel_list + [nb_inputs] for idx, (nb_in, nb_out, ksize) in enumerate(zip(channel_list[:-1], channel_list[1:], ksize_list[::-1])): self.add_link("deconv{}".format(idx), L.DeconvolutionND(1, nb_in, nb_out, ksize)) if no_act_last and idx == self.nb_layers - 1: continue self.add_link("bn{}".format(idx), L.BatchNormalization(nb_out))
Example #2
Source File: module.py From fpl with MIT License | 5 votes |
def __init__(self, nb_inputs, channel_list, ksize_list, no_act_last=False): super(Decoder, self).__init__() self.nb_layers = len(channel_list) self.no_act_last = no_act_last channel_list = channel_list + [nb_inputs] for idx, (nb_in, nb_out, ksize) in enumerate(zip(channel_list[:-1], channel_list[1:], ksize_list[::-1])): self.add_link("deconv{}".format(idx), L.DeconvolutionND(1, nb_in, nb_out, ksize)) if no_act_last and idx == self.nb_layers - 1: continue self.add_link("bn{}".format(idx), L.BatchNormalization(nb_out))
Example #3
Source File: spectral_normalization.py From chainer with MIT License | 5 votes |
def added(self, link): # Define axis and register ``u`` if the weight is initialized. if not hasattr(link, self.weight_name): raise ValueError( 'Weight \'{}\' does not exist!'.format(self.weight_name)) if isinstance(link, (L.Deconvolution2D, L.DeconvolutionND)): self.axis = 1 if getattr(link, self.weight_name).array is not None: self._prepare_parameters(link)
Example #4
Source File: model.py From brain_segmentation with MIT License | 5 votes |
def __init__(self, in_channels=1, n_classes=4): init = chainer.initializers.HeNormal(scale=0.01) super().__init__() with self.init_scope(): self.conv1a = L.ConvolutionND( 3, in_channels, 32, 3, pad=1, initialW=init) self.bnorm1a = L.BatchNormalization(32) self.conv1b = L.ConvolutionND( 3, 32, 32, 3, pad=1, initialW=init) self.bnorm1b = L.BatchNormalization(32) self.conv1c = L.ConvolutionND( 3, 32, 64, 3, stride=2, pad=1, initialW=init) self.voxres2 = VoxResModule() self.voxres3 = VoxResModule() self.bnorm3 = L.BatchNormalization(64) self.conv4 = L.ConvolutionND( 3, 64, 64, 3, stride=2, pad=1, initialW=init) self.voxres5 = VoxResModule() self.voxres6 = VoxResModule() self.bnorm6 = L.BatchNormalization(64) self.conv7 = L.ConvolutionND( 3, 64, 64, 3, stride=2, pad=1, initialW=init) self.voxres8 = VoxResModule() self.voxres9 = VoxResModule() self.c1deconv = L.DeconvolutionND( 3, 32, 32, 3, pad=1, initialW=init) self.c1conv = L.ConvolutionND( 3, 32, n_classes, 3, pad=1, initialW=init) self.c2deconv = L.DeconvolutionND( 3, 64, 64, 4, stride=2, pad=1, initialW=init) self.c2conv = L.ConvolutionND( 3, 64, n_classes, 3, pad=1, initialW=init) self.c3deconv = L.DeconvolutionND( 3, 64, 64, 6, stride=4, pad=1, initialW=init) self.c3conv = L.ConvolutionND( 3, 64, n_classes, 3, pad=1, initialW=init) self.c4deconv = L.DeconvolutionND( 3, 64, 64, 10, stride=8, pad=1, initialW=init) self.c4conv = L.ConvolutionND( 3, 64, n_classes, 3, pad=1, initialW=init)
Example #5
Source File: frame_seed_generator.py From tgan with MIT License | 5 votes |
def __init__(self, n_frames=16, z_slow_dim=256, z_fast_dim=256, wscale=0.01): super(FrameSeedGeneratorInitUniform, self).__init__() w = chainer.initializers.Uniform(wscale) with self.init_scope(): self.dc0 = L.DeconvolutionND(1, z_slow_dim, 512, 1, 1, 0, initialW=w) self.dc1 = L.DeconvolutionND(1, 512, 256, 4, 2, 1, initialW=w) self.dc2 = L.DeconvolutionND(1, 256, 128, 4, 2, 1, initialW=w) self.dc3 = L.DeconvolutionND(1, 128, 128, 4, 2, 1, initialW=w) self.dc4 = L.DeconvolutionND(1, 128, z_fast_dim, 4, 2, 1, initialW=w) self.bn0 = L.BatchNormalization(512) self.bn1 = L.BatchNormalization(256) self.bn2 = L.BatchNormalization(128) self.bn3 = L.BatchNormalization(128) self.z_slow_dim = z_slow_dim self.z_fast_dim = z_fast_dim
Example #6
Source File: frame_seed_generator.py From tgan with MIT License | 5 votes |
def __init__(self, n_frames=16, z_slow_dim=256, z_fast_dim=256): super(FrameSeedGeneratorInitDefault, self).__init__() w = None with self.init_scope(): self.dc0 = L.DeconvolutionND(1, z_slow_dim, 512, 1, 1, 0, initialW=w) self.dc1 = L.DeconvolutionND(1, 512, 256, 4, 2, 1, initialW=w) self.dc2 = L.DeconvolutionND(1, 256, 128, 4, 2, 1, initialW=w) self.dc3 = L.DeconvolutionND(1, 128, 128, 4, 2, 1, initialW=w) self.dc4 = L.DeconvolutionND(1, 128, z_fast_dim, 4, 2, 1, initialW=w) self.bn0 = L.BatchNormalization(512) self.bn1 = L.BatchNormalization(256) self.bn2 = L.BatchNormalization(128) self.bn3 = L.BatchNormalization(128) self.z_slow_dim = z_slow_dim self.z_fast_dim = z_fast_dim
Example #7
Source File: frame_seed_generator.py From tgan with MIT License | 5 votes |
def __init__(self, n_frames=16, z_slow_dim=256, z_fast_dim=256, wscale=0.01): super(FrameSeedGeneratorNoBetaInitUniform, self).__init__() w = chainer.initializers.Uniform(wscale) with self.init_scope(): self.dc0 = L.DeconvolutionND(1, z_slow_dim, 512, 1, 1, 0, initialW=w) self.dc1 = L.DeconvolutionND(1, 512, 256, 4, 2, 1, initialW=w) self.dc2 = L.DeconvolutionND(1, 256, 128, 4, 2, 1, initialW=w) self.dc3 = L.DeconvolutionND(1, 128, 128, 4, 2, 1, initialW=w) self.dc4 = L.DeconvolutionND(1, 128, z_fast_dim, 4, 2, 1, initialW=w) self.bn0 = L.BatchNormalization(512, use_beta=False) self.bn1 = L.BatchNormalization(256, use_beta=False) self.bn2 = L.BatchNormalization(128, use_beta=False) self.bn3 = L.BatchNormalization(128, use_beta=False) self.z_slow_dim = z_slow_dim self.z_fast_dim = z_fast_dim
Example #8
Source File: frame_seed_generator.py From tgan with MIT License | 5 votes |
def __init__(self, n_frames=16, z_slow_dim=256, z_fast_dim=256): super(FrameSeedGeneratorNoBetaInitDefault, self).__init__() w = None with self.init_scope(): self.dc0 = L.DeconvolutionND(1, z_slow_dim, 512, 1, 1, 0, initialW=w) self.dc1 = L.DeconvolutionND(1, 512, 256, 4, 2, 1, initialW=w) self.dc2 = L.DeconvolutionND(1, 256, 128, 4, 2, 1, initialW=w) self.dc3 = L.DeconvolutionND(1, 128, 128, 4, 2, 1, initialW=w) self.dc4 = L.DeconvolutionND(1, 128, z_fast_dim, 4, 2, 1, initialW=w) self.bn0 = L.BatchNormalization(512, use_beta=False) self.bn1 = L.BatchNormalization(256, use_beta=False) self.bn2 = L.BatchNormalization(128, use_beta=False) self.bn3 = L.BatchNormalization(128, use_beta=False) self.z_slow_dim = z_slow_dim self.z_fast_dim = z_fast_dim