I'm using Tensorflow 2.0 and trying to write a tf.keras.callbacks.Callback
that reads both the inputs and outputs of my model
for the batch.
I expected to be able to override on_batch_end
and access model.inputs
and model.outputs
but they are not EagerTensor
with a value that I could access. Is there anyway to access the actual tensors values that were involved in a batch?
This has many practical uses such as outputting these tensors to Tensorboard for debugging, or serializing them for other purposes. I am aware that I could just run the whole model again using model.predict
but that would force me to run every input twice through the network (and I might also have non-deterministic data generator). Any idea on how to achieve this?