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

Function TestTensorHandleDeviceName

tensorflow/go/tensor_handle_test.go:72–90  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

70}
71
72func TestTensorHandleDeviceName(t *testing.T) {
73 vals := [][]float32{{1.0, 2.0}, {3.0, 4.0}}
74 tensor, err := NewTensor(vals)
75 if err != nil {
76 t.Fatal(err)
77 }
78 th, err := NewTensorHandle(tensor)
79 if err != nil {
80 t.Fatal(err)
81 }
82
83 d, err := th.DeviceName()
84 if err != nil {
85 t.Fatal(err)
86 }
87 if !strings.Contains(d, "CPU") {
88 t.Errorf("DeviceName() did not return a CPU device; got: %s", d)
89 }
90}
91
92func TestTensorHandleBackingDeviceName(t *testing.T) {
93 vals := [][]float32{{1.0, 2.0}, {3.0, 4.0}}

Callers

nothing calls this directly

Calls 4

DeviceNameMethod · 0.95
NewTensorFunction · 0.85
NewTensorHandleFunction · 0.85
ContainsMethod · 0.45

Tested by

no test coverage detected