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

Function TestTensorHandleBackingDeviceName

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

Source from the content-addressed store, hash-verified

90}
91
92func TestTensorHandleBackingDeviceName(t *testing.T) {
93 vals := [][]float32{{1.0, 2.0}, {3.0, 4.0}}
94 tensor, err := NewTensor(vals)
95 if err != nil {
96 t.Fatal(err)
97 }
98 th, err := NewTensorHandle(tensor)
99 if err != nil {
100 t.Fatal(err)
101 }
102
103 d, err := th.BackingDeviceName()
104 if err != nil {
105 t.Fatal(err)
106 }
107 if !strings.Contains(d, "CPU") {
108 t.Errorf("BackingDeviceName() did not return a CPU device; got: %s", d)
109 }
110}
111
112func TestTensorHandleToTensor(t *testing.T) {
113 initialVals := [][]float32{{1.0, 2.0}, {3.0, 4.0}}

Callers

nothing calls this directly

Calls 4

BackingDeviceNameMethod · 0.95
NewTensorFunction · 0.85
NewTensorHandleFunction · 0.85
ContainsMethod · 0.45

Tested by

no test coverage detected