public abstract class AbstractDeviceData<T> extends java.lang.Object implements DeviceData<T>
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
_dataRef |
protected DataType<T> |
_dataType |
protected AbstractBaseDevice<?> |
_owner |
protected ReferenceCounter |
_refCounter |
Constructor and Description |
---|
AbstractDeviceData(AbstractBaseDevice<?> owner,
java.lang.Object ref,
DataType<T> dataType,
java.lang.Runnable cleanup) |
Modifier and Type | Method and Description |
---|---|
DataType<T> |
dataType() |
void |
decrementUsageCount() |
java.lang.Object |
getOrNull()
This returns the underlying raw data object of a nd-array or tensor
of a backend specific type (e.g.
|
void |
incrementUsageCount() |
Device<T> |
owner() |
int |
usages()
This method returns the number of times this data object is currently in use by a nd-array,
meaning that the number of usages is also the number of nd-arrays which are currently
referencing this data object.
|
protected final AbstractBaseDevice<?> _owner
protected final java.lang.Object _dataRef
protected final ReferenceCounter _refCounter
public AbstractDeviceData(AbstractBaseDevice<?> owner, java.lang.Object ref, DataType<T> dataType, java.lang.Runnable cleanup)
public final java.lang.Object getOrNull()
Data
Nda.getItems()
()} method, this will
return an unbiased view on the raw data of this tensor.
Be careful using this, as it exposes mutable state!public final void incrementUsageCount()
incrementUsageCount
in interface DeviceData<T>
public final void decrementUsageCount()
decrementUsageCount
in interface DeviceData<T>
public final int usages()
Data