(t *testing.T)
| 250 | } |
| 251 | |
| 252 | func TestSessionConfig(t *testing.T) { |
| 253 | // Exercise SessionOptions. |
| 254 | // Arguably, a better API would be for SessionOptions.Config to be the |
| 255 | // type generated by the protocol buffer compiler. But for now, the |
| 256 | // tensorflow package continues to be independent of protocol buffers |
| 257 | // and this test exercises the option since the implementation has a |
| 258 | // nuanced conversion to C types. |
| 259 | // |
| 260 | // Till then, the []byte form of Config here was generated using a toy |
| 261 | // tensorflow Python program: |
| 262 | /* |
| 263 | import tensorflow |
| 264 | c = tensorflow.ConfigProto() |
| 265 | c.intra_op_parallelism_threads = 1 |
| 266 | print c.SerializeToString() |
| 267 | */ |
| 268 | graph := NewGraph() |
| 269 | c, err := Const(graph, "Const", int32(14)) |
| 270 | if err != nil { |
| 271 | t.Fatal(err) |
| 272 | } |
| 273 | opts := SessionOptions{Config: []byte("(\x01")} |
| 274 | s, err := NewSession(graph, &opts) |
| 275 | if err != nil { |
| 276 | t.Fatal(err) |
| 277 | } |
| 278 | output, err := s.Run(nil, []Output{c}, nil) |
| 279 | if err != nil { |
| 280 | t.Fatal(err) |
| 281 | } |
| 282 | if output[0].Value().(int32) != 14 { |
| 283 | t.Fatalf("Got %v, want -1", output[0].Value()) |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | func TestListDevices(t *testing.T) { |
| 288 | s, err := NewSession(NewGraph(), nil) |
nothing calls this directly
no test coverage detected