Python chainer.initializers.HeUniform() Examples

The following are 6 code examples of chainer.initializers.HeUniform(). 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.initializers , or try the search function .
Example #1
Source File: rnn_cells.py    From knmt with GNU General Public License v3.0 5 votes vote down vote up
def create_initializer(init_type, scale=None, fillvalue=None):
    if init_type == 'identity':
        return initializers.Identity() if scale is None else initializers.Identity(scale=scale)
    if init_type == 'constant':
        return initializers.Constant(fillvalue)
    if init_type == 'zero':
        return initializers.Zero()
    if init_type == 'one':
        return initializers.One()
    if init_type == 'normal':
        return initializers.Normal() if scale is None else initializers.Normal(scale)
    if init_type == 'glorotNormal':
        return initializers.GlorotNormal() if scale is None else initializers.GlorotNormal(scale)
    if init_type == 'heNormal':
        return initializers.HeNormal() if scale is None else initializers.HeNormal(scale)
    if init_type == 'orthogonal':
        return initializers.Orthogonal(
            scale) if scale is None else initializers.Orthogonal(scale)
    if init_type == 'uniform':
        return initializers.Uniform(
            scale) if scale is None else initializers.Uniform(scale)
    if init_type == 'leCunUniform':
        return initializers.LeCunUniform(
            scale) if scale is None else initializers.LeCunUniform(scale)
    if init_type == 'glorotUniform':
        return initializers.GlorotUniform(
            scale) if scale is None else initializers.GlorotUniform(scale)
    if init_type == 'heUniform':
        return initializers.HeUniform(
            scale) if scale is None else initializers.HeUniform(scale)
    raise ValueError("Unknown initializer type: {0}".format(init_type)) 
Example #2
Source File: qlearning.py    From malmo-challenge with MIT License 5 votes vote down vote up
def _build_model(self):
        initializer = HeUniform()
        in_shape = self.input_shape[0]

        return [L.Convolution2D(in_shape, 64, ksize=4, stride=2,
                                initialW=initializer),
                L.Convolution2D(64, 64, ksize=3, stride=1,
                                initialW=initializer),
                L.Linear(None, 512, initialW=HeUniform(0.1)),
                L.Linear(512, self.output_shape, initialW=HeUniform(0.1))] 
Example #3
Source File: qlearning.py    From malmo-challenge with MIT License 5 votes vote down vote up
def _build_model(self):
        initializer = HeUniform()
        in_shape = self.input_shape[0]

        return [L.Convolution2D(in_shape, 32, ksize=8, stride=4,
                                initialW=initializer),
                L.Convolution2D(32, 64, ksize=4, stride=2,
                                initialW=initializer),
                L.Convolution2D(64, 64, ksize=3, stride=1,
                                initialW=initializer),
                L.Linear(7 * 7 * 64, 512, initialW=HeUniform(0.01)),
                L.Linear(512, self.output_shape, initialW=HeUniform(0.01))] 
Example #4
Source File: qlearning.py    From malmo-challenge with MIT License 5 votes vote down vote up
def _build_model(self):
        initializer = HeUniform()
        in_shape = self.input_shape[0]

        return [L.Convolution2D(in_shape, 64, ksize=4, stride=2,
                                initialW=initializer),
                L.Convolution2D(64, 64, ksize=3, stride=1,
                                initialW=initializer),
                L.Linear(None, 512, initialW=HeUniform(0.1)),
                L.Linear(512, self.output_shape, initialW=HeUniform(0.1))] 
Example #5
Source File: qlearning.py    From malmo-challenge with MIT License 5 votes vote down vote up
def _build_model(self):
        initializer = HeUniform()
        in_shape = self.input_shape[0]

        return [L.Convolution2D(in_shape, 32, ksize=8, stride=4,
                                initialW=initializer),
                L.Convolution2D(32, 64, ksize=4, stride=2,
                                initialW=initializer),
                L.Convolution2D(64, 64, ksize=3, stride=1,
                                initialW=initializer),
                L.Linear(7 * 7 * 64, 512, initialW=HeUniform(0.01)),
                L.Linear(512, self.output_shape, initialW=HeUniform(0.01))] 
Example #6
Source File: nets.py    From text-gcn-chainer with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
def __init__(self, adj, labels, feat_size, dropout=0.5):
        super(TextGCN, self).__init__()
        n_class = np.max(labels) + 1
        initializer = initializers.HeUniform()
        with self.init_scope():
            self.gconv1 = GraphConvolution(adj.shape[1], feat_size)
            self.gconv2 = GraphConvolution(feat_size, n_class)
        # This Variable will not be updated because require_grad=False
        self.input = to_chainer_sparse_variable(
            sp.identity(adj.shape[1]))
        self.adj = adj
        self.labels = labels
        self.dropout = dropout