smash.factory.Net.get_weight#
- Net.get_weight()[source]#
Get the weights of the trainable layers of the neural network
Net.- Returns:
- valuelist[
numpy.ndarray] A list of numpy arrays containing the weights of the trainable layers.
- valuelist[
See also
Net.set_weightSet the values of the weight in the neural network
Net.
Examples
>>> from smash.factory import Net >>> net = Net() >>> net.add_dense(2, input_shape=3, activation="tanh") >>> net +-------------------------------------------------------+ | Layer Type Input/Output Shape Num Parameters | +-------------------------------------------------------+ | Dense (3,)/(2,) 8 | | Activation (TanH) (2,)/(2,) 0 | +-------------------------------------------------------+ Total parameters: 8 Trainable parameters: 8
Set random weights
>>> net.set_weight(random_state=0)
Get the weight values
>>> net.get_weight() [array([[ 0.10694503, 0.47145628, 0.22514328], [ 0.09833413, -0.16726395, 0.31963799]])]