Browse Source

update:Gradients/nn_grad.cs

tags/yolov3
dataangel Haiping 4 years ago
parent
commit
bd51c8494d
1 changed files with 13 additions and 1 deletions
  1. +13
    -1
      src/TensorFlowNET.Core/Gradients/nn_grad.cs

+ 13
- 1
src/TensorFlowNET.Core/Gradients/nn_grad.cs View File

@@ -111,7 +111,7 @@ namespace Tensorflow.Gradients
"implementation's interaction with tf.gradients()");

var grad_0 = grads[0];
return new Tensor[]
{
_BroadcastMul(grad_0, sparse_softmax_grad_without_gradient),
@@ -119,6 +119,18 @@ namespace Tensorflow.Gradients
};
}

[RegisterGradient("SquaredDifference")]
public static Tensor[] _SquaredDifferenceGrad(Operation op, Tensor[] grads)
{
//"""Returns the gradient for (x-y)^2."""
Tensor x = op.inputs[0];
Tensor y = op.inputs[1];
return new Tensor[]
{
x,
y
};
}
/// <summary>
/// Gradient function for Conv2D.
/// </summary>


Loading…
Cancel
Save