load.hpp
Go to the documentation of this file.
1 
14 #ifndef MLPACK_CORE_DATA_LOAD_HPP
15 #define MLPACK_CORE_DATA_LOAD_HPP
16 
17 #include <mlpack/prereqs.hpp>
18 #include <mlpack/core/util/log.hpp>
19 #include <string>
20 
21 #include "format.hpp"
22 #include "dataset_mapper.hpp"
23 
24 namespace mlpack {
25 namespace data {
26 
61 template<typename eT>
62 bool Load(const std::string& filename,
63  arma::Mat<eT>& matrix,
64  const bool fatal = false,
65  const bool transpose = true);
66 
74 extern template bool Load<int>(const std::string&,
75  arma::Mat<int>&,
76  const bool,
77  const bool);
78 
79 // size_t and uword should be one of these three typedefs.
80 extern template bool Load<unsigned int>(const std::string&,
81  arma::Mat<unsigned int>&,
82  const bool,
83  const bool);
84 
85 extern template bool Load<unsigned long>(const std::string&,
86  arma::Mat<unsigned long>&,
87  const bool,
88  const bool);
89 
90 extern template bool Load<unsigned long long>(const std::string&,
91  arma::Mat<unsigned long long>&,
92  const bool,
93  const bool);
94 
95 extern template bool Load<float>(const std::string&,
96  arma::Mat<float>&,
97  const bool,
98  const bool);
99 
100 extern template bool Load<double>(const std::string&,
101  arma::Mat<double>&,
102  const bool,
103  const bool);
104 
136 template<typename eT>
137 bool Load(const std::string& filename,
138  arma::Col<eT>& vec,
139  const bool fatal = false);
140 
168 template<typename eT>
169 bool Load(const std::string& filename,
170  arma::Row<eT>& rowvec,
171  const bool fatal = false);
172 
205 template<typename eT, typename PolicyType>
206 bool Load(const std::string& filename,
207  arma::Mat<eT>& matrix,
208  DatasetMapper<PolicyType>& info,
209  const bool fatal = false,
210  const bool transpose = true);
211 
219 extern template bool Load<int, IncrementPolicy>(
220  const std::string&,
221  arma::Mat<int>&,
222  DatasetMapper<IncrementPolicy>&,
223  const bool,
224  const bool);
225 
226 extern template bool Load<arma::u32, IncrementPolicy>(
227  const std::string&,
228  arma::Mat<arma::u32>&,
229  DatasetMapper<IncrementPolicy>&,
230  const bool,
231  const bool);
232 
233 extern template bool Load<arma::u64, IncrementPolicy>(
234  const std::string&,
235  arma::Mat<arma::u64>&,
236  DatasetMapper<IncrementPolicy>&,
237  const bool,
238  const bool);
239 
240 extern template bool Load<float, IncrementPolicy>(
241  const std::string&,
242  arma::Mat<float>&,
243  DatasetMapper<IncrementPolicy>&,
244  const bool,
245  const bool);
246 
247 extern template bool Load<double, IncrementPolicy>(
248  const std::string&,
249  arma::Mat<double>&,
250  DatasetMapper<IncrementPolicy>&,
251  const bool,
252  const bool);
253 
283 template<typename T>
284 bool Load(const std::string& filename,
285  const std::string& name,
286  T& t,
287  const bool fatal = false,
289 
290 } // namespace data
291 } // namespace mlpack
292 
293 // Include implementation of model-loading Load() overload.
294 #include "load_model_impl.hpp"
295 // Include implementation of Load() for vectors.
296 #include "load_vec_impl.hpp"
297 
298 #endif
.hpp
Definition: add_to_po.hpp:21
format
Define the formats we can read through boost::serialization.
Definition: format.hpp:20
The core includes that mlpack expects; standard C++ includes and Armadillo.
bool Load(const std::string &filename, arma::Mat< eT > &matrix, const bool fatal=false, const bool transpose=true)
Loads a matrix from file, guessing the filetype from the extension.