更新时间:2023-12-01 22:06:10
您可以获取任何层的输出,而不仅仅是嵌入层,如此处:
You can get the output of any layer, not just an embedding layer, as described here:
from keras import backend as K
get_3rd_layer_output = K.function([model.layers[0].input],
[model.layers[3].output])
layer_output = get_3rd_layer_output([X])[0]
在您的情况下,您希望使用model.layers[0].output
而不是model.layers[3].output
.
In your case, you would want model.layers[0].output
instead of model.layers[3].output
.