How do I get the weights of a layer in Keras?

前端 未结 4 386
误落风尘
误落风尘 2020-12-08 02:38

I am using Windows 10, Python 3.5, and tensorflow 1.1.0. I have the following script:

import tensorflow as tf
import tensorflow.contrib.keras.api.keras.backe         


        
4条回答
  •  甜味超标
    2020-12-08 03:24

    you can also use layer name, if layers index number is confusing

    weights:

    model.get_layer(<< layer_name >>).get_weights()[0]
    

    Biases:

    model.get_layer(<< layer_name >>).get_weights()[1]
    

提交回复
热议问题