@@ -118,16 +118,27 @@ using namespace pybind11::literals;
118118
119119
120120/* *
121- * Read a CSV file into a tensor view
121+ * @brief Read a CSV file into a tensor view
122122 *
123123 * CSVs are currently read in using the Python interpreter through pybind11.
124- *This has a startup performance hit, but CSV reading is intended to be a
125- *slow-path function, so this is not a critical component to speed up. Currently
126- *1D and 2D tensors are supported only.
124+ * This has a startup performance hit, but CSV reading is intended to be a
125+ * slow-path function, so this is not a critical component to speed up. Currently
126+ * 1D and 2D tensors are supported only.
127+ *
128+ * @tparam TensorType
129+ * Data type of tensor
130+ * @param t
131+ * Tensor to read data into
132+ * @param fname
133+ * File path of .csv file
134+ * @param delimiter
135+ * Delimiter to use for CSV file
136+ * @param skip_header
137+ * Skip the header row of the CSV file, default as `true`.
127138 **/
128139template <typename TensorType>
129140void read_csv (TensorType &t, const std::string fname,
130- const std::string delimiter, bool header = true )
141+ const std::string delimiter, bool skip_header = true )
131142{
132143 MATX_NVTX_START (" " , matx::MATX_NVTX_LOG_API)
133144
@@ -146,18 +157,27 @@ void read_csv(TensorType &t, const std::string fname,
146157
147158 auto np = pybind11::module_::import (" numpy" );
148159 auto obj = np.attr (" genfromtxt" )(" fname" _a = fname.c_str (), " delimiter" _a = delimiter,
149- " skip_header" _a = header ? 1 : 0 ,
160+ " skip_header" _a = skip_header ,
150161 " dtype" _a = detail::MatXPybind::GetNumpyDtype<typename TensorType::scalar_type>());
151162 pb->NumpyToTensorView (t, obj);
152163}
153164
154165/* *
155- * Read a CSV file into a tensor view
166+ * Write a CSV file from a tensor view
156167 *
157- * CSVs are currently read in using the Python interpreter through pybind11.
158- *This has a startup performance hit, but CSV reading is intended to be a
159- *slow-path function, so this is not a critical component to speed up. Currently
160- *1D and 2D tensors are supported only.
168+ * CSVs are currently written using the Python interpreter through pybind11.
169+ * This has a startup performance hit, but CSV writing is intended to be a
170+ * slow-path function, so this is not a critical component to speed up. Currently
171+ * 1D and 2D tensors are supported only.
172+ *
173+ * @tparam TensorType
174+ * Data type of tensor
175+ * @param t
176+ * Tensor to write data from
177+ * @param fname
178+ * File path of .csv file
179+ * @param delimiter
180+ * Delimiter to use for CSV file
161181 **/
162182template <typename TensorType>
163183void write_csv (const TensorType &t, const std::string fname,
@@ -220,7 +240,7 @@ void read_mat(TensorType &t, const std::string fname,
220240}
221241
222242/* *
223- * @brief Read a MAT file into a tensor view
243+ * @brief Read a MAT file and return a tensor view
224244 *
225245 * MAT files use SciPy's loadmat() function to read various MATLAB file
226246 * types in. MAT files are supersets of HDF5 files, and are allowed to
@@ -232,7 +252,8 @@ void read_mat(TensorType &t, const std::string fname,
232252 * File name of .mat file
233253 * @param var
234254 * Variable name inside of .mat to read
235- *
255+ * @return
256+ * Tensor view of data read from file
236257 **/
237258template <typename TensorType>
238259auto read_mat (const std::string fname,
0 commit comments