Set learn rate factor of layer learnable parameter



layer = setLearnRateFactor(layer,parameterName,factor) sets the learn rate factor of the parameter with the name parameterName in layer to factor.

For built-in layers, you can set the learn rate factor directly by using the corresponding property. For example, for a convolution2dLayer layer, the syntax layer = setLearnRateFactor(layer,'Weights',factor) is equivalent to layer.WeightLearnRateFactor = factor.


collapse all

Set and get the learning rate factor of a learnable parameter of a custom PReLU layer.

Define a custom PReLU layer. To create this layer, save the file preluLayer.m in the current folder.

Create a layer array including the custom layer preluLayer.

layers = [ ...
    imageInputLayer([28 28 1])

Set the learn rate factor of the 'Alpha' learnable parameter of the preluLayer to 2.

layers(4) = setLearnRateFactor(layers(4),'Alpha',2);

View the updated learn rate factor.

factor = getLearnRateFactor(layers(4),'Alpha')
factor = 2

Input Arguments

collapse all

Input layer, specified as a scalar Layer object.

Parameter name, specified as a character vector or a string scalar.

Learning rate factor for the parameter, specified as a nonnegative scalar.

The software multiplies this factor by the global learning rate to determine the learning rate for the specified parameter. For example, if factor is 2, then the learning rate for the specified parameter is twice the current global learning rate. The software determines the global learning rate based on the settings specified with the trainingOptions function.

Example: 2

Introduced in R2017b