16d2eb3061f1bed8ade390c5e2a2c1de9daa3509,theanolm/optimizers/basicoptimizer.py,BasicOptimizer,__init__,#BasicOptimizer#Any#Any#Any#,16

Before Change


        gradients = tensor.grad(cost, wrt=list(self.network.params.values()))

        // Normalize the norm of the gradients to given maximum value.
        if "max_gradient_norm" in optimization_options:
            max_norm = optimization_options["max_gradient_norm"]
            epsilon = optimization_options["epsilon"]
            squares = [tensor.sqr(gradient) for gradient in gradients]
            sums = [tensor.sum(square) for square in squares]
            total_sum = sum(sums)  // sum over parameter variables
            norm = tensor.sqrt(total_sum)
            target_norm = tensor.clip(norm, 0.0, max_norm)
            gradients = [gradient * target_norm / (epsilon + norm)
                         for gradient in gradients]

        self._gradient_exprs = gradients
        self.gradient_update_function = \
            theano.function([self.network.minibatch_input,
                             self.network.minibatch_mask],

After Change


        self.network = network

        // Create Theano shared variables from the initial parameter values.
        self.params = {name: theano.shared(value, name)
                       for name, value in self.param_init_values.items()}

        // numerical stability / smoothing term to prevent divide-by-zero
        if not "epsilon" in optimization_options:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: senarvi/theanolm
Commit Name: 16d2eb3061f1bed8ade390c5e2a2c1de9daa3509
Time: 2015-12-04
Author: seppo.git@marjaniemi.com
File Name: theanolm/optimizers/basicoptimizer.py
Class Name: BasicOptimizer
Method Name: __init__


Project Name: Kamnitsask/deepmedic
Commit Name: b2f9f5dbaa24a39e6cea2f8f8df0dd721c0e467e
Time: 2017-10-30
Author: konstantinos.kamnitsas12@imperial.ac.uk
File Name: deepmedic/neuralnet/ops.py
Class Name:
Method Name: createAndInitializeWeightsTensor


Project Name: NeuromorphicProcessorProject/snn_toolbox
Commit Name: 1be7c5996fa959572854044d3cc580a2abc6bfa7
Time: 2016-11-25
Author: bodo.rueckauer@gmail.com
File Name: snntoolbox/core/inisim.py
Class Name:
Method Name: init_neurons