Main Content


Change network weights and biases to previous initialization values


net = revert (net)


net = revert (net) returns neural network net with weight and bias values restored to the values generated the last time the network was initialized.

If the network is altered so that it has different weight and bias connections or different input or layer sizes, then revert cannot set the weights and biases to their previous values and they are set to zeros instead.


Here a perceptron is created with input size set to 2 and number of neurons to 1.

net = perceptron;
net.inputs{1}.size = 2;
net.layers{1}.size = 1;

The initial network has weights and biases with zero values.

net.iw{1,1}, net.b{1}

Change these values as follows:

net.iw{1,1} = [1 2]; 
net.b{1} = 5;
net.iw{1,1}, net.b{1}

You can recover the network’s initial values as follows:

net = revert(net);
net.iw{1,1}, net.b{1}

Version History

Introduced before R2006a

See Also

| | |