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 CompressionDescriptorcompressionDescriptor-
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.PointeraddressPointer()Returns the address of the pointer wrapped in a PointerDataBuffercreate(double[] data)Create the data buffer with respect to the given byte bufferDataBuffercreate(float[] data)Create the data buffer with respect to the given byte bufferDataBuffercreate(int[] data)Create the data buffer with respect to the given byte bufferprotected DataBuffercreate(long length)Create with lengthDataBufferdup()Return a copy of this bufferprotected doublegetDoubleUnsynced(long index)protected floatgetFloatUnsynced(long index)protected intgetIntUnsynced(long index)protected longgetLongUnsynced(long index)protected voidinitTypeAndSize()Initialize the opType of this bufferlonglength()Returns the length of the buffervoidpointerIndexerByCurrentType(DataType currentType)static DataBufferreadUnknown(DataInputStream s, DataBuffer.AllocationMode allocMode, long length, DataType type)Drop-in replacement wrapper for BaseDataBuffer.read() method, aware of CompressedDataBufferDataBufferreallocate(long length)Reallocate the native memory of the bufferprotected voidsetIndexer(org.bytedeco.javacpp.indexer.Indexer indexer)voidsyncToPrimary()This method synchronizes host memoryvoidsyncToSpecial()This method synchronizes device memoryvoidwrite(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:
initTypeAndSizein classBaseDataBuffer
-
write
public void write(DataOutputStream out) throws IOException
- Specified by:
writein interfaceDataBuffer- Overrides:
writein classBaseDataBuffer- Throws:
IOException
-
setIndexer
protected void setIndexer(org.bytedeco.javacpp.indexer.Indexer indexer)
- Overrides:
setIndexerin classBaseDataBuffer
-
addressPointer
public org.bytedeco.javacpp.Pointer addressPointer()
Description copied from interface:DataBufferReturns the address of the pointer wrapped in a Pointer- Specified by:
addressPointerin interfaceDataBuffer- Specified by:
addressPointerin 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:DataBufferReturn a copy of this buffer- Specified by:
dupin interfaceDataBuffer- Overrides:
dupin classBaseDataBuffer- Returns:
- a copy of this buffer
-
length
public long length()
Description copied from interface:DataBufferReturns the length of the buffer- Specified by:
lengthin interfaceDataBuffer- Overrides:
lengthin classBaseDataBuffer- Returns:
- the length of the buffer
-
create
protected DataBuffer create(long length)
Create with length- Specified by:
createin 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:
createin 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:
createin 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:
createin classBaseDataBuffer- Parameters:
data- the buffer to create- Returns:
- the data buffer based on the given buffer
-
pointerIndexerByCurrentType
public void pointerIndexerByCurrentType(DataType currentType)
- Specified by:
pointerIndexerByCurrentTypein classBaseDataBuffer
-
reallocate
public DataBuffer reallocate(long length)
Description copied from interface:DataBufferReallocate the native memory of the buffer- Specified by:
reallocatein interfaceDataBuffer- Specified by:
reallocatein classBaseDataBuffer- Parameters:
length- the new length of the buffer- Returns:
- this databuffer
-
syncToPrimary
public void syncToPrimary()
Description copied from class:BaseDataBufferThis method synchronizes host memory- Specified by:
syncToPrimaryin classBaseDataBuffer
-
syncToSpecial
public void syncToSpecial()
Description copied from class:BaseDataBufferThis method synchronizes device memory- Specified by:
syncToSpecialin classBaseDataBuffer
-
getDoubleUnsynced
protected double getDoubleUnsynced(long index)
- Specified by:
getDoubleUnsyncedin classBaseDataBuffer
-
getFloatUnsynced
protected float getFloatUnsynced(long index)
- Specified by:
getFloatUnsyncedin classBaseDataBuffer
-
getLongUnsynced
protected long getLongUnsynced(long index)
- Specified by:
getLongUnsyncedin classBaseDataBuffer
-
getIntUnsynced
protected int getIntUnsynced(long index)
- Specified by:
getIntUnsyncedin classBaseDataBuffer
-
-