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

Function TestOperationDevice

tensorflow/go/operation_test.go:231–252  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

229}
230
231func 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
254func forceGC() {
255 var mem runtime.MemStats

Callers

nothing calls this directly

Calls 5

AddOperationMethod · 0.95
DataTypeMethod · 0.95
NewGraphFunction · 0.85
NewTensorFunction · 0.85
DeviceMethod · 0.45

Tested by

no test coverage detected