nnlib
GPU-accelerated, C/C++ neural network library.
|
Header file declaring methods that can be used when reading from files. More...
Go to the source code of this file.
Functions | |
bool | fileExists (const std::string &filepath) |
Check if a file exists with the provided filepath. More... | |
std::vector< std::string > | readFile (const std::string &filepath) |
Read file from a filepath. More... | |
sTensor | readCSV (const std::string &filepath, const std::string &delim=",", int numThreads=1) |
Read a csv file from a path. More... | |
Header file declaring methods that can be used when reading from files.
bool fileExists | ( | const std::string & | filepath | ) |
Check if a file exists with the provided filepath.
filepath | The filepath of the file to check. |
sTensor readCSV | ( | const std::string & | filepath, |
const std::string & | delim = "," , |
||
int | numThreads = 1 |
||
) |
Read a csv file from a path.
The method will first read all lines from the file and then divide the lines over numThreads
threads to split them into values. The values are then written into a matrix that is then returned.
filepath | The path to the csv file. |
delim | The delimiter to use when splitting data. |
numThreads | The number of threads to use when splitting data. |
std::vector<std::string> readFile | ( | const std::string & | filepath | ) |
Read file from a filepath.
Will attempt to read file with the provided filepath or in the parent directory of the filepath.
The method can only read text files and will not work on binary files.
filepath | The path to the file. |