MagmaDNN  1.0
c++NeuralNetworkFramework
tensor_io.cpp File Reference
#include "tensor/tensor_io.h"
Include dependency graph for tensor_io.cpp:

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)
 

Detailed Description

Author
Daniel Nichols
Version
1.0
Date
2019-04-05

Function Documentation

◆ read_csv_to_tensor()

template<typename T >
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.

See also
write_tensor_to_csv
Template Parameters
Tdata type
Parameters
ttensor to read values into
file_namefile name of csv file (should be a text file, not binary)
delimthe delimiter of the csv (assumed to be a comma)
Returns
magmadnn_error_t 0 if successful, otherwise anything else

◆ write_tensor_to_csv()

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 = 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.

See also
read_csv_to_tensor .
Template Parameters
Tdata type
Parameters
ttensor to write out
file_namecsv file to be written into. Created if it does not exist.
delimcharacter to delimit values
createcreate file if it does not exist.
Returns
magmadnn_error_t returns 0 if successful, otherwise something else