#include "tensor/tensor_io.h"
Functions | |
template<typename T > | |
magmadnn_error_t | magmadnn::io::read_csv_to_tensor (Tensor< T > &t, const std::string &file_name, char delim) |
template magmadnn_error_t | magmadnn::io::read_csv_to_tensor (Tensor< int > &, const std::string &, char) |
template magmadnn_error_t | magmadnn::io::read_csv_to_tensor (Tensor< float > &, const std::string &, char) |
template magmadnn_error_t | magmadnn::io::read_csv_to_tensor (Tensor< double > &, const std::string &, char) |
template<typename T > | |
magmadnn_error_t | magmadnn::io::write_tensor_to_csv (const Tensor< T > &t, const std::string &file_name, char delim, bool create) |
template magmadnn_error_t | magmadnn::io::write_tensor_to_csv (const Tensor< int > &, const std::string &, char, bool) |
template magmadnn_error_t | magmadnn::io::write_tensor_to_csv (const Tensor< float > &, const std::string &, char, bool) |
template magmadnn_error_t | magmadnn::io::write_tensor_to_csv (const Tensor< double > &, const std::string &, char, bool) |
magmadnn_error_t magmadnn::io::read_csv_to_tensor | ( | Tensor< T > & | t, |
const std::string & | file_name, | ||
char | delim = ',' |
||
) |
Reads from "file_name" into the tensor t. It interprets the data as having the flattened shape of the input tensor. Returns 0 if successfull, otherwise something else.
T | data type |
t | tensor to read values into |
file_name | file name of csv file (should be a text file, not binary) |
delim | the delimiter of the csv (assumed to be a comma) |
magmadnn_error_t magmadnn::io::write_tensor_to_csv | ( | const Tensor< T > & | t, |
const std::string & | file_name, | ||
char | delim = ',' , |
||
bool | create = true |
||
) |
Writes the tensor t to the file "file_name". It writes a flattened version of the file that is readable by read_csv_to_tensor.
T | data type |
t | tensor to write out |
file_name | csv file to be written into. Created if it does not exist. |
delim | character to delimit values |
create | create file if it does not exist. |