Browse Source

Fix double data type issue in hamming_loss_fn.

tags/v0.100.4-load-saved-model
Haiping Chen 2 years ago
parent
commit
3b0cdd878c
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/TensorFlowNET.Keras/Metrics/metrics_utils.cs

+ 1
- 1
src/TensorFlowNET.Keras/Metrics/metrics_utils.cs View File

@@ -31,7 +31,7 @@ public class metrics_utils
threshold = tf.reduce_max(y_pred, axis: -1, keepdims: true); threshold = tf.reduce_max(y_pred, axis: -1, keepdims: true);
// make sure [0, 0, 0] doesn't become [1, 1, 1] // make sure [0, 0, 0] doesn't become [1, 1, 1]
// Use abs(x) > eps, instead of x != 0 to check for zero // Use abs(x) > eps, instead of x != 0 to check for zero
y_pred = tf.logical_and(y_pred >= threshold, tf.abs(y_pred) > 1e-12);
y_pred = tf.logical_and(y_pred >= threshold, tf.abs(y_pred) > 1e-12f);
} }
else else
{ {


Loading…
Cancel
Save