ListDevices returns the list of devices associated with a Context.
()
| 99 | |
| 100 | // ListDevices returns the list of devices associated with a Context. |
| 101 | func (c *Context) ListDevices() ([]Device, error) { |
| 102 | status := newStatus() |
| 103 | devicesList := C.TFE_ContextListDevices(c.c, status.c) |
| 104 | if err := status.Err(); err != nil { |
| 105 | return nil, fmt.Errorf("SessionListDevices() failed: %v", err) |
| 106 | } |
| 107 | defer C.TF_DeleteDeviceList(devicesList) |
| 108 | return deviceSliceFromDeviceList(devicesList) |
| 109 | } |