> import tensorflow as tf
>
> class MyMetric(tf.keras.callbacks.Callback):
> def on_epoch_end(self,epoch,logs={}):
> # how to access X_train and X_val here
>
> ...
> model.fit(X_train,y_train,batch_size=32,epochs=10,validation_data=(X_val,y_val),shuffle=True,callbacks=[MyMetric()]
I am trying to implement a custom metric in tensorflow 2.0 using a callback. Within the on_epoch_end
method I need to access the training and validation data (the entire samples, not batches) as provided to the fit method. Is there any way to do this? Thanks!