(t *testing.T)
| 229 | } |
| 230 | |
| 231 | func TestOperationDevice(t *testing.T) { |
| 232 | graph := NewGraph() |
| 233 | v, err := NewTensor(float32(1.0)) |
| 234 | if err != nil { |
| 235 | t.Fatal(err) |
| 236 | } |
| 237 | op, err := graph.AddOperation(OpSpec{ |
| 238 | Type: "Const", |
| 239 | Name: "Const", |
| 240 | Attrs: map[string]interface{}{ |
| 241 | "dtype": v.DataType(), |
| 242 | "value": v, |
| 243 | }, |
| 244 | Device: "/device:GPU:0", |
| 245 | }) |
| 246 | if err != nil { |
| 247 | t.Fatal(err) |
| 248 | } |
| 249 | if got, want := op.Device(), "/device:GPU:0"; got != want { |
| 250 | t.Errorf("Got %q, want %q", got, want) |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | func forceGC() { |
| 255 | var mem runtime.MemStats |
nothing calls this directly
no test coverage detected