forked from gorgonia/gorgonia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevice.go
24 lines (16 loc) · 818 Bytes
/
device.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// +build !cuda
package gorgonia
import "gorgonia.org/tensor"
// Device represents the device where the code will be executed on. In this build, all code will run on the CPU
type Device int
const (
CPU Device = 0 // CPU the only device the graph will be executed on
)
// String implements fmt.Stringer and runtime.Stringer
func (d Device) String() string { return "CPU" }
// IsGPU will always return false in this build
func (d Device) IsGPU() bool { return false }
// Alloc allocates memory on the device. This is currently a NO-OP in this build
func (d Device) Alloc(extern External, size int64) (tensor.Memory, error) { return nil, nil }
// Free frees the memory on the device. This is currently a NO-OP in this build
func (d Device) Free(extern External, mem tensor.Memory, sie uint) error { return nil }