gorgonia.org/gorgonia@v0.9.17/device.go (about)

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