MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / createGraphAndOp

Function createGraphAndOp

tensorflow/go/operation_test.go:27–38  ·  view source on GitHub ↗

createGraphAndOp creates an Operation but loses the reference to the Graph.

()

Source from the content-addressed store, hash-verified

25
26// createGraphAndOp creates an Operation but loses the reference to the Graph.
27func 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
40func TestOperationLifetime(t *testing.T) {
41 // Ensure that the Graph is not garbage collected while the program

Callers 1

TestOperationLifetimeFunction · 0.85

Calls 5

DataTypeMethod · 0.95
NewTensorFunction · 0.85
int64Function · 0.85
NewGraphFunction · 0.85
PlaceholderFunction · 0.70

Tested by

no test coverage detected