Browse Source

Merge branch 'master' into patch-3

pull/675/head
Haiping GitHub 5 years ago
parent
commit
a1e2e1b748
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/TensorFlowNET.Keras/Utils/losses_utils.cs

+ 1
- 1
src/TensorFlowNET.Keras/Utils/losses_utils.cs View File

@@ -25,7 +25,7 @@ namespace Tensorflow.Keras.Utils
public static Tensor compute_weighted_loss(Tensor losses, Tensor sample_weight = null, string reduction = null, string name = null)
{
if (sample_weight == null)
sample_weight = losses.dtype.ToString()=="TF_DOUBLE"? tf.constant(1.0) : tf.constant(1.0f);
sample_weight = losses.dtype == TF_DataType.TF_DOUBLE ? tf.constant(1.0) : tf.constant(1.0f);
var weighted_losses = scale_losses_by_sample_weight(losses, sample_weight);
// Apply reduction function to the individual weighted losses.
var loss = reduce_weighted_loss(weighted_losses, reduction);


Loading…
Cancel
Save