Package org.datavec.api.writable
Class NDArrayWritable
- java.lang.Object
-
- org.datavec.api.writable.ArrayWritable
-
- org.datavec.api.writable.NDArrayWritable
-
- All Implemented Interfaces:
Serializable
,Comparable
,WritableComparable
,Writable
public class NDArrayWritable extends ArrayWritable implements WritableComparable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static byte
NDARRAY_SER_VERSION_HEADER
static byte
NDARRAY_SER_VERSION_HEADER_NULL
-
Constructor Summary
Constructors Constructor Description NDArrayWritable()
NDArrayWritable(INDArray array)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(@NonNull Object o)
boolean
equals(Object o)
Returns true iffo
is a ArrayWritable with the same value.INDArray
get()
double
getDouble(long i)
float
getFloat(long i)
int
getInt(long i)
long
getLong(long i)
WritableType
getType()
Get the type of the writable.int
hashCode()
long
length()
void
readFields(DataInput in)
Deserialize into a row vector of default type.void
set(INDArray array)
String
toString()
void
write(DataOutput out)
Serialize array data linearly.void
writeType(DataOutput out)
Write the type (a single short value) to the DataOutput.-
Methods inherited from class org.datavec.api.writable.ArrayWritable
toDouble, toFloat, toInt, toLong
-
-
-
-
Field Detail
-
NDARRAY_SER_VERSION_HEADER_NULL
public static final byte NDARRAY_SER_VERSION_HEADER_NULL
- See Also:
- Constant Field Values
-
NDARRAY_SER_VERSION_HEADER
public static final byte NDARRAY_SER_VERSION_HEADER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NDArrayWritable
public NDArrayWritable()
-
NDArrayWritable
public NDArrayWritable(INDArray array)
-
-
Method Detail
-
readFields
public void readFields(DataInput in) throws IOException
Deserialize into a row vector of default type.- Specified by:
readFields
in interfaceWritable
- Parameters:
in
-DataInput
to deseriablize this object from.- Throws:
IOException
-
writeType
public void writeType(DataOutput out) throws IOException
Description copied from interface:Writable
Write the type (a single short value) to the DataOutput. SeeWritableFactory
for details.- Specified by:
writeType
in interfaceWritable
- Parameters:
out
- DataOutput to write to- Throws:
IOException
- For errors during writing
-
getType
public WritableType getType()
Description copied from interface:Writable
Get the type of the writable.
-
write
public void write(DataOutput out) throws IOException
Serialize array data linearly.- Specified by:
write
in interfaceWritable
- Parameters:
out
-DataOuput
to serialize this object into.- Throws:
IOException
-
set
public void set(INDArray array)
-
get
public INDArray get()
-
equals
public boolean equals(Object o)
Returns true iffo
is a ArrayWritable with the same value.
-
compareTo
public int compareTo(@NonNull @NonNull Object o)
- Specified by:
compareTo
in interfaceComparable
-
length
public long length()
- Specified by:
length
in classArrayWritable
-
getDouble
public double getDouble(long i)
- Specified by:
getDouble
in classArrayWritable
-
getFloat
public float getFloat(long i)
- Specified by:
getFloat
in classArrayWritable
-
getInt
public int getInt(long i)
- Specified by:
getInt
in classArrayWritable
-
getLong
public long getLong(long i)
- Specified by:
getLong
in classArrayWritable
-
-