Package org.nd4j.linalg.compression
Class CompressedDataBuffer
- java.lang.Object
-
- org.nd4j.linalg.api.buffer.BaseDataBuffer
-
- org.nd4j.linalg.compression.CompressedDataBuffer
-
- All Implemented Interfaces:
Serializable
,AutoCloseable
,DataBuffer
public class CompressedDataBuffer extends BaseDataBuffer
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.nd4j.linalg.api.buffer.DataBuffer
DataBuffer.AllocationMode, DataBuffer.TypeEx
-
-
Field Summary
Fields Modifier and Type Field Description protected CompressionDescriptor
compressionDescriptor
-
Fields inherited from class org.nd4j.linalg.api.buffer.BaseDataBuffer
allocationMode, attached, constant, elementSize, indexer, length, offset, originalBuffer, originalOffset, parentWorkspace, pointer, referenced, released, TO_STRING_MAX_ELEMENTS, type, underlyingLength, workspaceGenerationId, wrappedDataBuffer
-
-
Constructor Summary
Constructors Constructor Description CompressedDataBuffer(org.bytedeco.javacpp.Pointer pointer, @NonNull CompressionDescriptor descriptor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.bytedeco.javacpp.Pointer
addressPointer()
Returns the address of the pointer wrapped in a PointerDataBuffer
create(double[] data)
Create the data buffer with respect to the given byte bufferDataBuffer
create(float[] data)
Create the data buffer with respect to the given byte bufferDataBuffer
create(int[] data)
Create the data buffer with respect to the given byte bufferprotected DataBuffer
create(long length)
Create with lengthDataBuffer
dup()
Return a copy of this bufferprotected double
getDoubleUnsynced(long index)
protected float
getFloatUnsynced(long index)
protected int
getIntUnsynced(long index)
protected long
getLongUnsynced(long index)
protected void
initTypeAndSize()
Initialize the opType of this bufferlong
length()
Returns the length of the buffervoid
pointerIndexerByCurrentType(DataType currentType)
static DataBuffer
readUnknown(DataInputStream s, DataBuffer.AllocationMode allocMode, long length, DataType type)
Drop-in replacement wrapper for BaseDataBuffer.read() method, aware of CompressedDataBufferDataBuffer
reallocate(long length)
Reallocate the native memory of the bufferprotected void
setIndexer(org.bytedeco.javacpp.indexer.Indexer indexer)
void
syncToPrimary()
This method synchronizes host memoryvoid
syncToSpecial()
This method synchronizes device memoryvoid
write(DataOutputStream out)
-
Methods inherited from class org.nd4j.linalg.api.buffer.BaseDataBuffer
addReferencing, address, allocationMode, array, asBytes, asDouble, asFloat, asInt, asLong, asNio, asNioDouble, asNioFloat, asNioInt, asNioLong, assign, assign, assign, assign, assign, assign, assign, assign, assign, assign, capacity, close, closeable, copyAtStride, dataType, destroy, dirty, doReadObject, equals, fillPointerWithZero, flush, fromFloat, getDouble, getDoublesAt, getDoublesAt, getElementSize, getFloat, getFloatsAt, getFloatsAt, getGenerationId, getInt, getIntsAt, getIntsAt, getLong, getLongsAt, getLongsAt, getNumber, getParentWorkspace, getShort, hashCode, indexer, isAttached, isConstant, isInScope, isPersist, markReleased, offset, originalDataBuffer, originalOffset, persist, pickReferent, platformAddress, pointer, put, put, put, put, put, putByDestinationType, read, read, readContent, readHeader, references, release, removeReferencing, sameUnderlyingData, setConstant, setData, setData, setData, setData, setData, setData, setData, setNioBuffer, toFloat, toString, underlyingDataBuffer, underlyingLength, unPersist, wasClosed, wrappedBuffer, write
-
-
-
-
Field Detail
-
compressionDescriptor
protected CompressionDescriptor compressionDescriptor
-
-
Constructor Detail
-
CompressedDataBuffer
public CompressedDataBuffer(org.bytedeco.javacpp.Pointer pointer, @NonNull @NonNull CompressionDescriptor descriptor)
-
-
Method Detail
-
initTypeAndSize
protected void initTypeAndSize()
Initialize the opType of this buffer- Specified by:
initTypeAndSize
in classBaseDataBuffer
-
write
public void write(DataOutputStream out) throws IOException
- Specified by:
write
in interfaceDataBuffer
- Overrides:
write
in classBaseDataBuffer
- Throws:
IOException
-
setIndexer
protected void setIndexer(org.bytedeco.javacpp.indexer.Indexer indexer)
- Overrides:
setIndexer
in classBaseDataBuffer
-
addressPointer
public org.bytedeco.javacpp.Pointer addressPointer()
Description copied from interface:DataBuffer
Returns the address of the pointer wrapped in a Pointer- Specified by:
addressPointer
in interfaceDataBuffer
- Specified by:
addressPointer
in classBaseDataBuffer
- Returns:
- the address of the pointer wrapped in a Pointer
-
readUnknown
public static DataBuffer readUnknown(DataInputStream s, DataBuffer.AllocationMode allocMode, long length, DataType type)
Drop-in replacement wrapper for BaseDataBuffer.read() method, aware of CompressedDataBuffer- Parameters:
s
-- Returns:
-
dup
public DataBuffer dup()
Description copied from interface:DataBuffer
Return a copy of this buffer- Specified by:
dup
in interfaceDataBuffer
- Overrides:
dup
in classBaseDataBuffer
- Returns:
- a copy of this buffer
-
length
public long length()
Description copied from interface:DataBuffer
Returns the length of the buffer- Specified by:
length
in interfaceDataBuffer
- Overrides:
length
in classBaseDataBuffer
- Returns:
- the length of the buffer
-
create
protected DataBuffer create(long length)
Create with length- Specified by:
create
in classBaseDataBuffer
- Parameters:
length
- a databuffer of the same opType as this with the given length- Returns:
- a data buffer with the same length and datatype as this one
-
create
public DataBuffer create(double[] data)
Create the data buffer with respect to the given byte buffer- Specified by:
create
in classBaseDataBuffer
- Parameters:
data
- the buffer to create- Returns:
- the data buffer based on the given buffer
-
create
public DataBuffer create(float[] data)
Create the data buffer with respect to the given byte buffer- Specified by:
create
in classBaseDataBuffer
- Parameters:
data
- the buffer to create- Returns:
- the data buffer based on the given buffer
-
create
public DataBuffer create(int[] data)
Create the data buffer with respect to the given byte buffer- Specified by:
create
in classBaseDataBuffer
- Parameters:
data
- the buffer to create- Returns:
- the data buffer based on the given buffer
-
pointerIndexerByCurrentType
public void pointerIndexerByCurrentType(DataType currentType)
- Specified by:
pointerIndexerByCurrentType
in classBaseDataBuffer
-
reallocate
public DataBuffer reallocate(long length)
Description copied from interface:DataBuffer
Reallocate the native memory of the buffer- Specified by:
reallocate
in interfaceDataBuffer
- Specified by:
reallocate
in classBaseDataBuffer
- Parameters:
length
- the new length of the buffer- Returns:
- this databuffer
-
syncToPrimary
public void syncToPrimary()
Description copied from class:BaseDataBuffer
This method synchronizes host memory- Specified by:
syncToPrimary
in classBaseDataBuffer
-
syncToSpecial
public void syncToSpecial()
Description copied from class:BaseDataBuffer
This method synchronizes device memory- Specified by:
syncToSpecial
in classBaseDataBuffer
-
getDoubleUnsynced
protected double getDoubleUnsynced(long index)
- Specified by:
getDoubleUnsynced
in classBaseDataBuffer
-
getFloatUnsynced
protected float getFloatUnsynced(long index)
- Specified by:
getFloatUnsynced
in classBaseDataBuffer
-
getLongUnsynced
protected long getLongUnsynced(long index)
- Specified by:
getLongUnsynced
in classBaseDataBuffer
-
getIntUnsynced
protected int getIntUnsynced(long index)
- Specified by:
getIntUnsynced
in classBaseDataBuffer
-
-