Keras - is it possible to view the weights and biases of models in Tensorboard

keras, python, tensorboard, tensorflow

Solution

You can get the weights and biases per layer and for the entire model with `.get_weights()`.

For example if the first layer of your model is the dense layer for which you would like to have your weights and biases, you can get them with:

weights, biases = model.layers[0].get_weights()

Problem

I just got started with Keras and built a Q-learning example program. I created a tensorboard callback and I include it in the call to model.fit, but the only things that appear in TensorBoard are the scalar summary for the loss and the network graph. Interestingly, if I open up the dense layer in the graph, I see a little summary icon labeled "bias_0" and one labeled "kernel_0", but I don't see these appearing in the distributions or histograms tabs in TensorBoard like I did when I built a model in pure tensorflow. Do I need to do something else to enable these in Tensorboard? Do I need to look into the details of the model that Keras produces and add my own tensor_summary() calls?

Original source

Related problems