Custom tensorflow.compat.v1.metrics

Viewed 24

I currently have my eval_metric_ops configured like this for the train_and_evaluate process:

eval_metric_ops = {"mean_squared_error": tf.compat.v1.metrics.mean_squared_error(
             labels=features['image'],
             predictions= model.denoise_fn(normalize_data(features['image']), features['label'])),
                   }

My loss is defined like this:

def meanflat(x):
  return tf.reduce_mean(x, axis=list(range(1, len(x.shape))))

loss = nn.meanflat(tf.squared_difference(noise, x_recon))

How can I apply tf.squared_difference to the eval_metric_ops definition?

0 Answers
Related