4704e86551c33ebfdf6e2227c350014a8d06c116,paysage/models/model_utils.py,ComputationGraph,set_trainable_layers,#ComputationGraph#Any#,593

Before Change


            None

        
        for layer_index in range(self.num_layers):
            self.layer_connections[layer_index].trainable = (layer_index in trainable_layers)
            // if the layer is not trainable, set the weights as untrainable
            if not self.layer_connections[layer_index].trainable:
                for weight_index in self.layer_connections[layer_index].left_connected_weights:
                    self.weight_connections[weight_index].trainable = False

    def set_excluded_layers(self, excluded_layers):
        
        Convenience function to set the excluded layers.
        Sets exactly the given layers as excluded (e.g. unexcludes any others).

After Change


        self.trainable_layers = trainable_layers
        // set weights where an untrainable layer is a higher index to untrainable
        untrainable_layers = list(set(range(len())) - set(trainable_layers))
        untrainable_weights = []
        for weight_index in self.weight_connections:
            if weight_index[1] in untrainable_layers:
                untrainable_weights.append(weight_index)
        self.trainable_weights = sorted(list(set(range(len(self.weight_connections)))
                                            - set(untrainable_weights)))

    def set_excluded_layers(self, excluded_layers):
        
        Exclude a list of layers.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: drckf/paysage
Commit Name: 4704e86551c33ebfdf6e2227c350014a8d06c116
Time: 2017-05-17
Author: jrwalsh1@gmail.com
File Name: paysage/models/model_utils.py
Class Name: ComputationGraph
Method Name: set_trainable_layers


Project Name: brian-team/brian2
Commit Name: 8d60cb0e1b7d501cf774039f55b450e26cceb26b
Time: 2013-05-03
Author: marcel.stimberg@ens.fr
File Name: brian2/stateupdaters/exact.py
Class Name: LinearStateUpdater
Method Name: __call__


Project Name: drckf/paysage
Commit Name: 1fa77c2ca2daa62ecad77dd0d6ba5e1f7b025cd8
Time: 2017-05-17
Author: jrwalsh1@gmail.com
File Name: paysage/models/model_utils.py
Class Name: ComputationGraph
Method Name: set_trainable_layers