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

Function TestContextConfigListDevices

tensorflow/go/context_test.go:36–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func TestContextConfigListDevices(t *testing.T) {
37 c, err := NewContext(nil)
38 if err != nil {
39 t.Fatal(err)
40 }
41 devs, err := c.ListDevices()
42 if err != nil {
43 t.Fatal(err)
44 }
45 if len(devs) < 1 {
46 t.Fatalf("No devices found using ListDevices()")
47 }
48 foundCPUDevice := false
49 for _, d := range devs {
50 if d.Type == "CPU" {
51 foundCPUDevice = true
52 }
53 }
54 if !foundCPUDevice {
55 t.Error("Failed to find CPU device using ListDevices()")
56 }
57}

Callers

nothing calls this directly

Calls 3

ListDevicesMethod · 0.95
NewContextFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected