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

Function TestConcurrency

tensorflow/go/session_test.go:164–185  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

162}
163
164func TestConcurrency(t *testing.T) {
165 tensor, err := NewTensor(int64(1))
166 if err != nil {
167 t.Fatalf("NewTensor(): %v", err)
168 }
169
170 graph, inp, out := createTestGraph(t, tensor.DataType())
171 s, err := NewSession(graph, &SessionOptions{})
172 if err != nil {
173 t.Fatalf("NewSession(): %v", err)
174 }
175 for i := 0; i < 100; i++ {
176 // Session may close before Run() starts, so we don't check the error.
177 go s.Run(map[Output]*Tensor{inp: tensor}, []Output{out}, []*Operation{out.Op})
178 }
179 if err = s.Close(); err != nil {
180 t.Errorf("Close() 1: %v", err)
181 }
182 if err = s.Close(); err != nil {
183 t.Errorf("Close() 2: %v", err)
184 }
185}
186
187func ExamplePartialRun() {
188 var (

Callers

nothing calls this directly

Calls 7

DataTypeMethod · 0.95
RunMethod · 0.95
CloseMethod · 0.95
NewTensorFunction · 0.85
int64Function · 0.85
createTestGraphFunction · 0.85
NewSessionFunction · 0.70

Tested by

no test coverage detected