1
$\begingroup$

I built an autoencoder model of three layers with 9 5 9. Input dim =9, encoder dim =5, output dim=9 When I get the model weights,

weight1=autoencoder.layers[1].get_weights()
weight2=autoencoder.layers[2].get_weights()
print(weight1)
[array([[ 0.0023533 , -0.02289476, -0.01658   ,  0.03487475, -0.38416424],
       [ 0.00594878,  0.01835718,  0.01768207,  0.04458401,  0.10922299],
       [ 0.03288281,  0.22234452,  0.04393397, -0.14807932,  0.04412287],
       [ 0.16347113,  0.02014653, -0.05967368, -0.09127634,  0.9797626 ],
       [-0.0901033 ,  0.1602385 , -0.16297013,  0.43326673, -0.2514738 ],
       [ 0.00272129, -0.00525797,  0.01420719, -0.04066049, -0.01261563],
       [ 0.40665478, -0.07740633, -0.02576585,  0.0406443 , -0.218632  ],
       [-0.00641229,  0.08050939, -0.02497054, -0.12399215,  0.10901988],
       [-0.14366671,  0.02168852,  0.19099002, -0.10509221, -0.4306924 ]],
      dtype=float32), array([-0.0133634 ,  0.14412224,  0.13419336, -0.32834613, -0.31566525],
      dtype=float32)]

There have two array in weight1. I know the first array means but how to explain the second array?

$\endgroup$
1
$\begingroup$

Does the layer contain two matrices, one for the actual weights and one for the biases?

There could be one bias value for each of the columns in your weight matrix, depending on how you built your model.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.