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 #include "image_info.hpp"
24 
25 namespace mlpack {
26 namespace data {
27 
62 template<typename eT>
63 bool Load(const std::string& filename,
64  arma::Mat<eT>& matrix,
65  const bool fatal = false,
66  const bool transpose = true);
67 
75 extern template bool Load<int>(const std::string&,
76  arma::Mat<int>&,
77  const bool,
78  const bool);
79 
80 // size_t and uword should be one of these three typedefs.
81 extern template bool Load<unsigned int>(const std::string&,
82  arma::Mat<unsigned int>&,
83  const bool,
84  const bool);
85 
86 extern template bool Load<unsigned long>(const std::string&,
87  arma::Mat<unsigned long>&,
88  const bool,
89  const bool);
90 
91 extern template bool Load<unsigned long long>(const std::string&,
92  arma::Mat<unsigned long long>&,
93  const bool,
94  const bool);
95 
96 extern template bool Load<float>(const std::string&,
97  arma::Mat<float>&,
98  const bool,
99  const bool);
100 
101 extern template bool Load<double>(const std::string&,
102  arma::Mat<double>&,
103  const bool,
104  const bool);
105 
137 template<typename eT>
138 bool Load(const std::string& filename,
139  arma::Col<eT>& vec,
140  const bool fatal = false);
141 
169 template<typename eT>
170 bool Load(const std::string& filename,
171  arma::Row<eT>& rowvec,
172  const bool fatal = false);
173 
206 template<typename eT, typename PolicyType>
207 bool Load(const std::string& filename,
208  arma::Mat<eT>& matrix,
209  DatasetMapper<PolicyType>& info,
210  const bool fatal = false,
211  const bool transpose = true);
212 
220 extern template bool Load<int, IncrementPolicy>(
221  const std::string&,
222  arma::Mat<int>&,
223  DatasetMapper<IncrementPolicy>&,
224  const bool,
225  const bool);
226 
227 extern template bool Load<arma::u32, IncrementPolicy>(
228  const std::string&,
229  arma::Mat<arma::u32>&,
230  DatasetMapper<IncrementPolicy>&,
231  const bool,
232  const bool);
233 
234 extern template bool Load<arma::u64, IncrementPolicy>(
235  const std::string&,
236  arma::Mat<arma::u64>&,
237  DatasetMapper<IncrementPolicy>&,
238  const bool,
239  const bool);
240 
241 extern template bool Load<float, IncrementPolicy>(
242  const std::string&,
243  arma::Mat<float>&,
244  DatasetMapper<IncrementPolicy>&,
245  const bool,
246  const bool);
247 
248 extern template bool Load<double, IncrementPolicy>(
249  const std::string&,
250  arma::Mat<double>&,
251  DatasetMapper<IncrementPolicy>&,
252  const bool,
253  const bool);
254 
284 template<typename T>
285 bool Load(const std::string& filename,
286  const std::string& name,
287  T& t,
288  const bool fatal = false,
290 
294 #ifdef HAS_STB
295 
306 template<typename eT>
307 bool Load(const std::string& filename,
308  arma::Mat<eT>& matrix,
309  ImageInfo& info,
310  const bool fatal = false,
311  const bool transpose = true);
312 
323 template<typename eT>
324 bool Load(const std::vector<std::string>& files,
325  arma::Mat<eT>& matrix,
326  ImageInfo& info,
327  const bool fatal = false,
328  const bool transpose = true);
329 
330 #endif // HAS_STB.
331 
332 } // namespace data
333 } // namespace mlpack
334 
335 // Include implementation of model-loading Load() overload.
336 #include "load_model_impl.hpp"
337 // Include implementation of Load() for vectors.
338 #include "load_vec_impl.hpp"
339 // Include implementation of Load() for images.
340 #include "load_image_impl.hpp"
341 
342 #endif
strip_type.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.