diff --git a/tensorflow/go/graph_test.go b/tensorflow/go/graph_test.go index d8f32dbaa93..067c7db5c3c 100644 --- a/tensorflow/go/graph_test.go +++ b/tensorflow/go/graph_test.go @@ -223,7 +223,7 @@ func TestGraphAddGradientsSums(t *testing.T) { } } -func TestGraphAddGradientsWithInitialValuesToGraph(t *testing.T) { +func TestGraphAddGradientsWithInitialValues(t *testing.T) { g := NewGraph() x, err := Placeholder(g, "x", Float) op0, err := g.AddOperation(OpSpec{ @@ -332,4 +332,9 @@ func TestGraphValidateGradientsNames(t *testing.T) { if !strings.HasPrefix(grads3[0].Op.Name(), "even_more_gradients/") { t.Fatalf("Got name %v, wanted started with even_more_gradients/", grads3[0].Op.Name()) } + + _, err = g.AddGradients("even_more_gradients", []Output{y0}, []Output{x}, nil) + if err == nil { + t.Error("AddGradients should have failed if gradients name is already existing") + } }