12 #ifndef MLPACK_BINDINGS_CLI_GET_PARAM_HPP 13 #define MLPACK_BINDINGS_CLI_GET_PARAM_HPP 31 const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
33 const typename std::enable_if<!std::is_same<T,
34 std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0)
37 return *boost::any_cast<T>(&d.
value);
48 const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
54 typedef std::tuple<T, typename ParameterType<T>::type> TupleType;
55 TupleType& tuple = *boost::any_cast<TupleType>(&d.
value);
56 const std::string& value = std::get<0>(std::get<1>(tuple));
57 T& matrix = std::get<0>(tuple);
58 size_t& n_rows = std::get<1>(std::get<1>(tuple));
59 size_t& n_cols = std::get<2>(std::get<1>(tuple));
63 if (arma::is_Row<T>::value || arma::is_Col<T>::value)
67 n_rows = matrix.n_rows;
68 n_cols = matrix.n_cols;
83 const typename std::enable_if<std::is_same<T,
84 std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0)
88 typedef std::tuple<T, std::tuple<std::string, size_t, size_t>> TupleType;
89 TupleType* tuple = boost::any_cast<TupleType>(&d.
value);
90 const std::string& value = std::get<0>(std::get<1>(*tuple));
91 T& t = std::get<0>(*tuple);
92 size_t& n_rows = std::get<1>(std::get<1>(*tuple));
93 size_t& n_cols = std::get<2>(std::get<1>(*tuple));
97 n_rows = std::get<1>(t).n_rows;
98 n_cols = std::get<1>(t).n_cols;
113 const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
118 typedef std::tuple<T*, std::string> TupleType;
119 TupleType* tuple = boost::any_cast<TupleType>(&d.
value);
120 const std::string& value = std::get<1>(*tuple);
126 std::get<0>(*tuple) = model;
128 return std::get<0>(*tuple);
143 *((T**) output) = &GetParam<typename std::remove_pointer<T>::type>(d);
Definition: has_serialize.hpp:47
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
bool input
True if this option is an input option (otherwise, it is output).
Definition: param_data.hpp:73
The core includes that mlpack expects; standard C++ includes and Armadillo.
bool noTranspose
True if this is a matrix that should not be transposed.
Definition: param_data.hpp:69
T & GetParam(util::ParamData &d, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if<!data::HasSerialize< T >::value >::type *=0, const typename std::enable_if<!std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>::value >::type *=0)
This overload is called when nothing special needs to happen to the name of the parameter.
Definition: get_param.hpp:29
This structure holds all of the information about a single parameter, including its value (which is s...
Definition: param_data.hpp:52
bool loaded
If this is an input parameter that needs extra loading, this indicates whether or not it has been loa...
Definition: param_data.hpp:76
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.
Definition: load_impl.hpp:89
boost::any value
The actual value that is held.
Definition: param_data.hpp:82