Device

lamp.Device
See theDevice companion object
sealed trait Device

Represents a device where tensors are stored and tensor operations are executed

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object CPU.type
class CudaDevice
object MPS.type
Self type

Members list

Value members

Abstract methods

def measureTime[A](f: => A): (A, Long)
def setSeed(seed: Long): Unit
def to(t: Tensor): Tensor
def to[S : Sc](t: STenOptions): STenOptions

Concrete methods

def allocateBuffers[S : Sc](size: Long, options: STenOptions): BufferPair
def to[S : Sc](t: STen): STen
def toBatched[S : Sc](tensors: Seq[STen], buffers: BufferPair): Seq[STen]

Copies tensors to this device in a single cross device copy. Data is copied via a buffer pair which consists of a source and a destinatin buffer. srcBuffer is supposed to be on the source device. dstBuffer has to be on this device. Tensors are first copied to the srcBuffer, then the srcBuffer is copied to dstBuffer, then the dstBuffer is split into views.

Copies tensors to this device in a single cross device copy. Data is copied via a buffer pair which consists of a source and a destinatin buffer. srcBuffer is supposed to be on the source device. dstBuffer has to be on this device. Tensors are first copied to the srcBuffer, then the srcBuffer is copied to dstBuffer, then the dstBuffer is split into views.

All tensors must have the same data type.

Might make sense to pin the srcBuffer.

Attributes

def withOtherStream[A](synchronizeBefore: Boolean, synchronizeAfter: Boolean)(f: => A): A

Executes f on a new stream

Executes f on a new stream

f must not switch to other threads

Restores the stream to the original stream Optionally synchronizes the host before and/or after f

Attributes