2

I'm implementing a convolutional neural network using lasagne nolearn.

I'd like to fix some parameters that prelearned. How can I set some layers untrainable?

Actually, though I removed 'trainable' attribute of some layers, the number shown in the layer information before fitting, namely, such as

Neural Network with *** learnable parameters never change.

Besides, I'm afraid that the greeting function in 'handers.py'

def _get_greeting(nn):
    shapes = [param.get_value().shape for param in
              nn.get_all_params() if param]

should be

nn.get_all_params(trainable=True) if param]

but I'm not sure how it affect on training.

idjaw
  • 25,487
  • 7
  • 64
  • 83
Naoaki ONO
  • 91
  • 1
  • 3
  • 1
    If I understand your question correctly, you want to pass only a set of your layers into your updates. I've just been implementing something similar, and I've just simply removed some parameters from the parameter list: `params = lasagne.layers.get_all_params(network, trainable=True)` and then `params = params[-4:]` This selects the last 4 layers in my network, leaving the first layers untrained. This can be generalised by picking out the layer that you want stop training on using something like: `lasagne.layers.get_all_layers` and then filtering out which layers (parameters) to be trained. – Cosades Feb 26 '16 at 12:50

0 Answers0