Package org.flag4j.io
Class TensorReader
java.lang.Object
org.flag4j.io.TensorReader
The TensorReader class provides several static methods for reading serialized
tensors, matrices, and vectors from a file.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Matrix
readMatrix
(String fileName) Reads a serializedmatrix
from a specified file using aTensorInputStream
.static Tensor
readTensor
(String fileName) Reads a serializedtensor
from a specified file using aTensorInputStream
.static Vector
readVector
(String fileName) Reads a serializedvector
from a specified file using aTensorInputStream
.
-
Constructor Details
-
TensorReader
private TensorReader()
-
-
Method Details
-
readTensor
Reads a serializedtensor
from a specified file using aTensorInputStream
. If an exception is thrown while reading, the result will be null.- Parameters:
fileName
- File name, including extension, of the file containing the serialized tensor.- Returns:
- The deserialized tensor from the specified file. If an exception is thrown while reading, the result will be null.
-
readMatrix
Reads a serializedmatrix
from a specified file using aTensorInputStream
. If an exception is thrown while reading, the result will be null.- Parameters:
fileName
- File name, including extension, of the file containing the serialized matrix.- Returns:
- The deserialized matrix from the specified file. If an exception is thrown while reading, the result will be null.
-
readVector
Reads a serializedvector
from a specified file using aTensorInputStream
. If an exception is thrown while reading, the result will be null.- Parameters:
fileName
- File name, including extension, of the file containing the serialized vector.- Returns:
- The deserialized vector from the specified file. If an exception is thrown while reading, the result will be null.
-