mlpack  3.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
65 template<typename eT>
66 bool Load(const std::string& filename,
67  arma::Mat<eT>& matrix,
68  const bool fatal = false,
69  const bool transpose = true,
70  const arma::file_type inputLoadType = arma::auto_detect);
71 
101 template<typename eT>
102 bool Load(const std::string& filename,
103  arma::SpMat<eT>& matrix,
104  const bool fatal = false,
105  const bool transpose = true);
106 
114 extern template bool Load<int>(const std::string&,
115  arma::Mat<int>&,
116  const bool,
117  const bool,
118  const arma::file_type);
119 
120 // size_t and uword should be one of these three typedefs.
121 extern template bool Load<unsigned int>(const std::string&,
122  arma::Mat<unsigned int>&,
123  const bool,
124  const bool,
125  const arma::file_type);
126 
127 extern template bool Load<unsigned long>(const std::string&,
128  arma::Mat<unsigned long>&,
129  const bool,
130  const bool,
131  const arma::file_type);
132 
133 extern template bool Load<unsigned long long>(const std::string&,
134  arma::Mat<unsigned long long>&,
135  const bool,
136  const bool,
137  const arma::file_type);
138 
139 extern template bool Load<float>(const std::string&,
140  arma::Mat<float>&,
141  const bool,
142  const bool,
143  const arma::file_type);
144 
145 extern template bool Load<double>(const std::string&,
146  arma::Mat<double>&,
147  const bool,
148  const bool,
149  const arma::file_type);
150 
151 extern template bool Load<int>(const std::string&,
152  arma::Mat<int>&,
153  const bool,
154  const bool,
155  const arma::file_type);
156 
157 extern template bool Load<unsigned int>(const std::string&,
158  arma::SpMat<unsigned int>&,
159  const bool,
160  const bool);
161 
162 extern template bool Load<unsigned long>(const std::string&,
163  arma::SpMat<unsigned long>&,
164  const bool,
165  const bool);
166 
167 extern template bool Load<unsigned long long>(const std::string&,
168  arma::SpMat<unsigned long long>&,
169  const bool,
170  const bool);
171 
172 extern template bool Load<float>(const std::string&,
173  arma::SpMat<float>&,
174  const bool,
175  const bool);
176 
177 extern template bool Load<double>(const std::string&,
178  arma::SpMat<double>&,
179  const bool,
180  const bool);
181 
213 template<typename eT>
214 bool Load(const std::string& filename,
215  arma::Col<eT>& vec,
216  const bool fatal = false);
217 
245 template<typename eT>
246 bool Load(const std::string& filename,
247  arma::Row<eT>& rowvec,
248  const bool fatal = false);
249 
282 template<typename eT, typename PolicyType>
283 bool Load(const std::string& filename,
284  arma::Mat<eT>& matrix,
285  DatasetMapper<PolicyType>& info,
286  const bool fatal = false,
287  const bool transpose = true);
288 
296 extern template bool Load<int, IncrementPolicy>(
297  const std::string&,
298  arma::Mat<int>&,
299  DatasetMapper<IncrementPolicy>&,
300  const bool,
301  const bool);
302 
303 extern template bool Load<arma::u32, IncrementPolicy>(
304  const std::string&,
305  arma::Mat<arma::u32>&,
306  DatasetMapper<IncrementPolicy>&,
307  const bool,
308  const bool);
309 
310 extern template bool Load<arma::u64, IncrementPolicy>(
311  const std::string&,
312  arma::Mat<arma::u64>&,
313  DatasetMapper<IncrementPolicy>&,
314  const bool,
315  const bool);
316 
317 extern template bool Load<float, IncrementPolicy>(
318  const std::string&,
319  arma::Mat<float>&,
320  DatasetMapper<IncrementPolicy>&,
321  const bool,
322  const bool);
323 
324 extern template bool Load<double, IncrementPolicy>(
325  const std::string&,
326  arma::Mat<double>&,
327  DatasetMapper<IncrementPolicy>&,
328  const bool,
329  const bool);
330 
360 template<typename T>
361 bool Load(const std::string& filename,
362  const std::string& name,
363  T& t,
364  const bool fatal = false,
366 
380 template<typename eT>
381 bool Load(const std::string& filename,
382  arma::Mat<eT>& matrix,
383  ImageInfo& info,
384  const bool fatal = false);
385 
395 template<typename eT>
396 bool Load(const std::vector<std::string>& files,
397  arma::Mat<eT>& matrix,
398  ImageInfo& info,
399  const bool fatal = false);
400 
401 // Implementation found in load_image.cpp.
402 bool LoadImage(const std::string& filename,
403  arma::Mat<unsigned char>& matrix,
404  ImageInfo& info,
405  const bool fatal = false);
406 
407 } // namespace data
408 } // namespace mlpack
409 
410 // Include implementation of model-loading Load() overload.
411 #include "load_model_impl.hpp"
412 // Include implementation of Load() for vectors.
413 #include "load_vec_impl.hpp"
414 // Include implementation of Load() for images.
415 #include "load_image_impl.hpp"
416 
417 #endif
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 LoadImage(const std::string &filename, arma::Mat< unsigned char > &matrix, ImageInfo &info, const bool fatal=false)
bool Load(const std::string &filename, arma::Mat< eT > &matrix, const bool fatal=false, const bool transpose=true, const arma::file_type inputLoadType=arma::auto_detect)
Loads a matrix from file, guessing the filetype from the extension.
src mlpack core util version hpp VERSION_HPP_CONTENTS string(REGEX REPLACE".*#define MLPACK_VERSION_MAJOR ([0-9]+).*""\\1"MLPACK_VERSION_MAJOR"${VERSION_HPP_CONTENTS}") string(REGEX REPLACE".* MLPACK_VERSION_MINOR "$
Definition: CMakeLists.txt:79