#include <string>
#include <fstream>
#include <sstream>
#include "types.h"
#include "tensor.h"
Go to the source code of this file.
- Author
- Daniel Nichols
- Version
- 1.0
- Date
- 2019-04-05
- Copyright
- Copyright (c) 2019
◆ 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
-
- Parameters
-
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) |
- 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
-
- Parameters
-
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. |
- Returns
- magmadnn_error_t returns 0 if successful, otherwise something else