Python 为什么在培训期间只设置零偏差?

Python 为什么在培训期间只设置零偏差?,python,tensorflow,keras,deep-learning,tensor,Python,Tensorflow,Keras,Deep Learning,Tensor,有人知道为什么在训练过程中偏差的位置只有零吗 train_data=np.array(non_consteled_data222) test_data=np.array(non_consteled_data222) print_weights = tf.keras.callbacks.LambdaCallback(on_epoch_end=lambda epoch, logs: print(autoencoder.layers[10].get_weights())) early_stopping

有人知道为什么在训练过程中偏差的位置只有零吗

train_data=np.array(non_consteled_data222)
test_data=np.array(non_consteled_data222)
print_weights = tf.keras.callbacks.LambdaCallback(on_epoch_end=lambda epoch, logs: print(autoencoder.layers[10].get_weights()))
early_stopping = tf.keras.callbacks.EarlyStopping(patience=15,mode='auto',monitor='val_loss')
autoencoder.fit({'main_input':train_data},{'main_output':test_data},epochs=1000,batch_size=1,callbacks=[early_stopping, print_weights])
偏差如下所示

Train on 10000 samples
Epoch 1/1000
 9986/10000 [============================>.] - ETA: 0s - loss: 1.2531WARNING:tensorflow:Early stopping conditioned on metric `val_loss` which is not available. Available metrics are: loss
[array([[ 0.04418396,  0.09718815,  0.06509767, ..., -0.08258158,
        -0.04137728, -0.02635098],
       [-0.05798168,  0.10809173, -0.08804472, ...,  0.05473133,
         0.10758243,  0.02331964],
       [ 0.08164211,  0.00655604,  0.01100099, ..., -0.05781808,
        -0.0935961 ,  0.04643583],
       ...,
       [ 0.05952457,  0.10624295,  0.057764  , ..., -0.09977948,
        -0.0364738 ,  0.01292781],
       [-0.05471221,  0.09876775, -0.02606663, ...,  0.10430572,
        -0.05373028, -0.10538645],
       [-0.07313187,  0.06518059,  0.01615911, ...,  0.07252979,
        -0.09280436,  0.08314239]], dtype=float32), array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0.], dtype=float32)]
10000/10000 [==============================] - 19s 2ms/sample - loss: 1.2531
Epoch 2/1000
 9999/10000 [============================>.] - ETA: 0s - loss: 1.2530WARNING:tensorflow:Early stopping conditioned on metric `val_loss` which is not available. Available metrics are: loss
[array([[ 0.04418396,  0.09718815,  0.06509767, ..., -0.08258158,
        -0.04137728, -0.02635098],
       [-0.05798168,  0.10809173, -0.08804472, ...,  0.05473133,
         0.10758243,  0.02331964],
       [ 0.08164211,  0.00655604,  0.01100099, ..., -0.05781808,
        -0.0935961 ,  0.04643583],
       ...,
       [ 0.05952457,  0.10624295,  0.057764  , ..., -0.09977948,
        -0.0364738 ,  0.01292781],
       [-0.05471221,  0.09876775, -0.02606663, ...,  0.10430572,
        -0.05373028, -0.10538645],
       [-0.07313187,  0.06518059,  0.01615911, ...,  0.07252979,
        -0.09280436,  0.08314239]], dtype=float32), array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0.], dtype=float32)]
10000/10000 [==============================] - 19s 2ms/sample - loss: 1.2530
我看到了一个类似问题的一些答案,它说这是由将第一个变量设置为零引起的。 但在我的例子中,即使在第二纪元之后,偏差仍然保持零值。所以我想解决这个问题


如果您给我任何机会,我必须感谢您。

该模型的代码在该网站上。谢谢你和以前一样的评论:如果你的lambda函数不是专门使用tensorflow或keras函数,就不会有反向传播,你的权重和偏差就不会训练。