createGraphAndOp creates an Operation but loses the reference to the Graph.
()
| 25 | |
| 26 | // createGraphAndOp creates an Operation but loses the reference to the Graph. |
| 27 | func createGraphAndOp() (*Operation, error) { |
| 28 | t, err := NewTensor(int64(1)) |
| 29 | if err != nil { |
| 30 | return nil, err |
| 31 | } |
| 32 | g := NewGraph() |
| 33 | output, err := Placeholder(g, "my_placeholder", t.DataType()) |
| 34 | if err != nil { |
| 35 | return nil, err |
| 36 | } |
| 37 | return output.Op, nil |
| 38 | } |
| 39 | |
| 40 | func TestOperationLifetime(t *testing.T) { |
| 41 | // Ensure that the Graph is not garbage collected while the program |
no test coverage detected