Mixing keras and tf.keras is bad karma; only the same one should be used and it should be tf.keras.
Tensorflow Keras stuff outside layers
Everything should be done by:
- Using keras.backend functions,
- Lambda layers,
- Designated keras functions with the same behavior.
When you are using tf operation – you are getting tf tensor object which doesn’t have history field. When you use keras functions you will get keras.tensors.