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

Function hasOperations

tensorflow/go/graph_test.go:26–53  ·  view source on GitHub ↗
(g *Graph, ops ...string)

Source from the content-addressed store, hash-verified

24)
25
26func hasOperations(g *Graph, ops ...string) error {
27 var missing []string
28 for _, op := range ops {
29 if g.Operation(op) == nil {
30 missing = append(missing, op)
31 }
32 }
33 if len(missing) != 0 {
34 return fmt.Errorf("Graph does not have the operations %v", missing)
35 }
36
37 inList := map[string]bool{}
38 for _, op := range g.Operations() {
39 inList[op.Name()] = true
40 }
41
42 for _, op := range ops {
43 if !inList[op] {
44 missing = append(missing, op)
45 }
46 }
47
48 if len(missing) != 0 {
49 return fmt.Errorf("Operations %v are missing from graph.Operations()", missing)
50 }
51
52 return nil
53}
54
55func TestGraphWriteToAndImport(t *testing.T) {
56 // Construct a graph

Callers 1

Calls 4

appendFunction · 0.85
OperationsMethod · 0.80
OperationMethod · 0.45
NameMethod · 0.45

Tested by

no test coverage detected