Package org.nd4j.linalg.compression
Class BasicNDArrayCompressor
- java.lang.Object
-
- org.nd4j.linalg.compression.BasicNDArrayCompressor
-
public class BasicNDArrayCompressor extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,NDArrayCompressor>codecsprotected StringdefaultCompression
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidautoDecompress(INDArray array)voidautoDecompress(INDArray... arrays)Decompress several ndarraysINDArraycompress(double[] array)This method returns compressed INDArray instance which contains JVM array passed inINDArraycompress(float[] array)This method returns compressed INDArray instance which contains JVM array passed inDataBuffercompress(DataBuffer buffer)Compress the given data buffer given the default compression algorithmDataBuffercompress(DataBuffer buffer, String algorithm)Compress the data buffer given a specified algorithmINDArraycompress(INDArray array)INDArraycompress(INDArray array, String algorithm)Returns a compressed version of the given ndarrayvoidcompressi(INDArray array)In place compression of the passed in ndarray with the default compression algorithmvoidcompressi(INDArray array, String algorithm)In place Compress the given ndarray with the given algorithmDataBufferdecompress(DataBuffer buffer, DataType targetType)Decompress the given databufferINDArraydecompress(INDArray array)voiddecompressi(INDArray array)in place decompression of the given ndarray.Set<String>getAvailableCompressors()Get the set of available codecs for compressionNDArrayCompressorgetCompressor(@NonNull String name)StringgetDefaultCompression()Get the default compression algorithm as a string.static BasicNDArrayCompressorgetInstance()Get the ndarray compressor singletonprotected voidloadCompressors()voidprintAvailableCompressors()Prints available compressors to standard outBasicNDArrayCompressorsetDefaultCompression(@NonNull String algorithm)Set the default compression algorithm
-
-
-
Field Detail
-
codecs
protected Map<String,NDArrayCompressor> codecs
-
defaultCompression
protected String defaultCompression
-
-
Method Detail
-
loadCompressors
protected void loadCompressors()
-
getAvailableCompressors
public Set<String> getAvailableCompressors()
Get the set of available codecs for compression- Returns:
-
printAvailableCompressors
public void printAvailableCompressors()
Prints available compressors to standard out
-
getInstance
public static BasicNDArrayCompressor getInstance()
Get the ndarray compressor singleton- Returns:
-
setDefaultCompression
public BasicNDArrayCompressor setDefaultCompression(@NonNull @NonNull String algorithm)
Set the default compression algorithm- Parameters:
algorithm- the algorithm to set- Returns:
-
getDefaultCompression
public String getDefaultCompression()
Get the default compression algorithm as a string. This is an all caps algorithm with a representation in the CompressionAlgorithm enum- Returns:
-
compress
public DataBuffer compress(DataBuffer buffer)
Compress the given data buffer given the default compression algorithm- Parameters:
buffer- the data buffer to compress- Returns:
- the compressed version of the data buffer
-
compress
public DataBuffer compress(DataBuffer buffer, String algorithm)
Compress the data buffer given a specified algorithm- Parameters:
buffer- the buffer to compressalgorithm- the algorithm to compress use- Returns:
- the compressed data buffer
-
compressi
public void compressi(INDArray array)
In place compression of the passed in ndarray with the default compression algorithm- Parameters:
array-
-
compress
public INDArray compress(INDArray array, String algorithm)
Returns a compressed version of the given ndarray- Parameters:
array- the array to compressalgorithm- the algorithm to compress with- Returns:
- a compressed copy of this ndarray
-
compressi
public void compressi(INDArray array, String algorithm)
In place Compress the given ndarray with the given algorithm- Parameters:
array- the array to compressalgorithm-
-
decompress
public DataBuffer decompress(DataBuffer buffer, DataType targetType)
Decompress the given databuffer- Parameters:
buffer- the databuffer to compress- Returns:
- the decompressed databuffer
-
getCompressor
public NDArrayCompressor getCompressor(@NonNull @NonNull String name)
-
decompressi
public void decompressi(INDArray array)
in place decompression of the given ndarray. If the ndarray isn't compressed this will do nothing- Parameters:
array- the array to decompressed if it is comprssed
-
autoDecompress
public void autoDecompress(INDArray... arrays)
Decompress several ndarrays- Parameters:
arrays-
-
autoDecompress
public void autoDecompress(INDArray array)
- Parameters:
array-
-
compress
public INDArray compress(float[] array)
This method returns compressed INDArray instance which contains JVM array passed in- Parameters:
array-- Returns:
-
compress
public INDArray compress(double[] array)
This method returns compressed INDArray instance which contains JVM array passed in- Parameters:
array-- Returns:
-
-