(t *testing.T)
| 162 | } |
| 163 | |
| 164 | func 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 | |
| 187 | func ExamplePartialRun() { |
| 188 | var ( |
nothing calls this directly
no test coverage detected