Python Binding now...

Signed-off-by: Omar Shrit <omar@shrit.me>
This commit is contained in:
Omar Shrit
2021-06-27 16:57:27 +02:00
parent 863c5672e5
commit fe7bfbbb78
12 changed files with 191 additions and 191 deletions
+12 -12
View File
@@ -26,12 +26,12 @@ namespace python {
template<typename T>
std::string DefaultParamImpl(
util::ParamData& data,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
const typename boost::disable_if<std::is_same<T, std::string>>::type* = 0,
const typename boost::disable_if<std::is_same<T,
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* = 0);
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<!util::IsStdVector<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::string>::value>::type* = 0,
const typename std::enable_if<!std::is_same<T,
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0);
/**
* Return the default value of a vector option.
@@ -39,7 +39,7 @@ std::string DefaultParamImpl(
template<typename T>
std::string DefaultParamImpl(
util::ParamData& data,
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0);
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0);
/**
* Return the default value of a string option.
@@ -47,7 +47,7 @@ std::string DefaultParamImpl(
template<typename T>
std::string DefaultParamImpl(
util::ParamData& data,
const typename boost::enable_if<std::is_same<T, std::string>>::type* = 0);
const typename std::enable_if<std::is_same<T, std::string>::value>::type* = 0);
/**
* Return the default value of a matrix option, a tuple option, a
@@ -57,10 +57,10 @@ std::string DefaultParamImpl(
template<typename T>
std::string DefaultParamImpl(
util::ParamData& data,
const typename boost::enable_if_c<
const typename std::enable_if<
arma::is_arma_type<T>::value ||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
arma::mat>>::value>::type* /* junk */ = 0);
arma::mat>>::value>::type* = 0);
/**
* Return the default value of a model option (this returns the default
@@ -69,8 +69,8 @@ std::string DefaultParamImpl(
template<typename T>
std::string DefaultParamImpl(
util::ParamData& data,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
/**
* Return the default value of an option. This is the function that will be
@@ -24,12 +24,12 @@ namespace python {
template<typename T>
std::string DefaultParamImpl(
util::ParamData& data,
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
const typename boost::disable_if<util::IsStdVector<T>>::type* /* junk */,
const typename boost::disable_if<data::HasSerialize<T>>::type* /* junk */,
const typename boost::disable_if<std::is_same<T, std::string>>::type*,
const typename boost::disable_if<std::is_same<T,
std::tuple<mlpack::data::DatasetInfo, arma::mat>>>::type* /* junk */)
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
const typename std::enable_if<!util::IsStdVector<T>::value>::type* /* junk */,
const typename std::enable_if<!data::HasSerialize<T>::value>::type* /* junk */,
const typename std::enable_if<!std::is_same<T, std::string>::value>::type*,
const typename std::enable_if<!std::is_same<T,
std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* /* junk */)
{
std::ostringstream oss;
if (std::is_same<T, bool>::value)
@@ -46,7 +46,7 @@ std::string DefaultParamImpl(
template<typename T>
std::string DefaultParamImpl(
util::ParamData& data,
const typename boost::enable_if<util::IsStdVector<T>>::type* /* junk */)
const typename std::enable_if<util::IsStdVector<T>::value>::type* /* junk */)
{
// Print each element in an array delimited by square brackets.
std::ostringstream oss;
@@ -89,7 +89,7 @@ std::string DefaultParamImpl(
template<typename T>
std::string DefaultParamImpl(
util::ParamData& data,
const typename boost::enable_if<std::is_same<T, std::string>>::type*)
const typename std::enable_if<std::is_same<T, std::string>::value>::type*)
{
const std::string& s = *boost::any_cast<std::string>(&data.value);
return "'" + s + "'";
@@ -102,7 +102,7 @@ std::string DefaultParamImpl(
template<typename T>
std::string DefaultParamImpl(
util::ParamData& /* data */,
const typename boost::enable_if_c<
const typename std::enable_if<
arma::is_arma_type<T>::value ||
std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
arma::mat>>::value>::type* /* junk */)
@@ -134,8 +134,8 @@ std::string DefaultParamImpl(
template<typename T>
std::string DefaultParamImpl(
util::ParamData& /* data */,
const typename boost::disable_if<arma::is_arma_type<T>>::type* /* junk */,
const typename boost::enable_if<data::HasSerialize<T>>::type* /* junk */)
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* /* junk */,
const typename std::enable_if<data::HasSerialize<T>::value>::type* /* junk */)
{
return "None";
}
+22 -22
View File
@@ -23,9 +23,9 @@ namespace python {
template<typename T>
inline std::string GetCythonType(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0)
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0)
{
return "unknown";
}
@@ -33,9 +33,9 @@ inline std::string GetCythonType(
template<>
inline std::string GetCythonType<int>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<int>>::type*,
const typename boost::disable_if<data::HasSerialize<int>>::type*,
const typename boost::disable_if<arma::is_arma_type<int>>::type*)
const typename std::enable_if<!util::IsStdVector<int>::value>::type*,
const typename std::enable_if<!data::HasSerialize<int>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<int>::value>::type*)
{
return "int";
}
@@ -43,9 +43,9 @@ inline std::string GetCythonType<int>(
template<>
inline std::string GetCythonType<double>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<double>>::type*,
const typename boost::disable_if<data::HasSerialize<double>>::type*,
const typename boost::disable_if<arma::is_arma_type<double>>::type*)
const typename std::enable_if<!util::IsStdVector<double>::value>::type*,
const typename std::enable_if<!data::HasSerialize<double>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<double>::value>::type*)
{
return "double";
}
@@ -53,9 +53,9 @@ inline std::string GetCythonType<double>(
template<>
inline std::string GetCythonType<std::string>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<std::string>>::type*,
const typename boost::disable_if<data::HasSerialize<std::string>>::type*,
const typename boost::disable_if<arma::is_arma_type<std::string>>::type*)
const typename std::enable_if<!util::IsStdVector<std::string>::value>::type*,
const typename std::enable_if<!data::HasSerialize<std::string>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<std::string>::value>::type*)
{
return "string";
}
@@ -63,9 +63,9 @@ inline std::string GetCythonType<std::string>(
template<>
inline std::string GetCythonType<size_t>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<size_t>>::type*,
const typename boost::disable_if<data::HasSerialize<size_t>>::type*,
const typename boost::disable_if<arma::is_arma_type<size_t>>::type*)
const typename std::enable_if<!util::IsStdVector<size_t>::value>::type*,
const typename std::enable_if<!data::HasSerialize<size_t>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<size_t>::value>::type*)
{
return "size_t";
}
@@ -73,9 +73,9 @@ inline std::string GetCythonType<size_t>(
template<>
inline std::string GetCythonType<bool>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<bool>>::type*,
const typename boost::disable_if<data::HasSerialize<bool>>::type*,
const typename boost::disable_if<arma::is_arma_type<bool>>::type*)
const typename std::enable_if<!util::IsStdVector<bool>::value>::type*,
const typename std::enable_if<!data::HasSerialize<bool>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<bool>::value>::type*)
{
return "cbool";
}
@@ -83,7 +83,7 @@ inline std::string GetCythonType<bool>(
template<typename T>
inline std::string GetCythonType(
util::ParamData& d,
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0)
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0)
{
return "vector[" + GetCythonType<typename T::value_type>(d) + "]";
}
@@ -91,7 +91,7 @@ inline std::string GetCythonType(
template<typename T>
inline std::string GetCythonType(
util::ParamData& d,
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
{
std::string type = "Mat";
if (T::is_row)
@@ -105,8 +105,8 @@ inline std::string GetCythonType(
template<typename T>
inline std::string GetCythonType(
util::ParamData& d,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
{
return d.cppType + "*";
}
@@ -25,11 +25,11 @@ namespace python {
template<typename T>
std::string GetPrintableParam(
util::ParamData& data,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
const typename boost::disable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<!util::IsStdVector<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<data::DatasetInfo, arma::mat>>::value>::type* = 0)
{
std::ostringstream oss;
oss << boost::any_cast<T>(data.value);
@@ -42,7 +42,7 @@ std::string GetPrintableParam(
template<typename T>
std::string GetPrintableParam(
util::ParamData& data,
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0)
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0)
{
const T& t = boost::any_cast<T>(data.value);
@@ -58,7 +58,7 @@ std::string GetPrintableParam(
template<typename T>
std::string GetPrintableParam(
util::ParamData& data,
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
{
// Get the matrix.
const T& matrix = boost::any_cast<T>(data.value);
@@ -74,8 +74,8 @@ std::string GetPrintableParam(
template<typename T>
std::string GetPrintableParam(
util::ParamData& data,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
{
std::ostringstream oss;
oss << data.cppType << " model at " << boost::any_cast<T*>(data.value);
@@ -88,8 +88,8 @@ std::string GetPrintableParam(
template<typename T>
std::string GetPrintableParam(
util::ParamData& data,
const typename boost::enable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
const typename std::enable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
{
// Get the matrix.
const T& tuple = boost::any_cast<T>(data.value);
@@ -23,84 +23,84 @@ namespace python {
template<typename T>
inline std::string GetPrintableType(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::disable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<!std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
template<>
inline std::string GetPrintableType<int>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<int>>::type*,
const typename boost::disable_if<data::HasSerialize<int>>::type*,
const typename boost::disable_if<arma::is_arma_type<int>>::type*,
const typename boost::disable_if<std::is_same<int,
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
const typename std::enable_if<!util::IsStdVector<int>::value>::type*,
const typename std::enable_if<!data::HasSerialize<int>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<int>::value>::type*,
const typename std::enable_if<!std::is_same<int,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
template<>
inline std::string GetPrintableType<double>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<double>>::type*,
const typename boost::disable_if<data::HasSerialize<double>>::type*,
const typename boost::disable_if<arma::is_arma_type<double>>::type*,
const typename boost::disable_if<std::is_same<double,
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
const typename std::enable_if<!util::IsStdVector<double>::value>::type*,
const typename std::enable_if<!data::HasSerialize<double>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<double>::value>::type*,
const typename std::enable_if<!std::is_same<double,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
template<>
inline std::string GetPrintableType<std::string>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<std::string>>::type*,
const typename boost::disable_if<data::HasSerialize<std::string>>::type*,
const typename boost::disable_if<arma::is_arma_type<std::string>>::type*,
const typename boost::disable_if<std::is_same<std::string,
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
const typename std::enable_if<!util::IsStdVector<std::string>::value>::type*,
const typename std::enable_if<!data::HasSerialize<std::string>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<std::string>::value>::type*,
const typename std::enable_if<!std::is_same<std::string,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
template<>
inline std::string GetPrintableType<size_t>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<size_t>>::type*,
const typename boost::disable_if<data::HasSerialize<size_t>>::type*,
const typename boost::disable_if<arma::is_arma_type<size_t>>::type*,
const typename boost::disable_if<std::is_same<size_t,
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
const typename std::enable_if<!util::IsStdVector<size_t>::value>::type*,
const typename std::enable_if<!data::HasSerialize<size_t>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<size_t>::value>::type*,
const typename std::enable_if<!std::is_same<size_t,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
template<>
inline std::string GetPrintableType<bool>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<bool>>::type*,
const typename boost::disable_if<data::HasSerialize<bool>>::type*,
const typename boost::disable_if<arma::is_arma_type<bool>>::type*,
const typename boost::disable_if<std::is_same<bool,
std::tuple<data::DatasetInfo, arma::mat>>>::type*);
const typename std::enable_if<!util::IsStdVector<bool>::value>::type*,
const typename std::enable_if<!data::HasSerialize<bool>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<bool>::value>::type*,
const typename std::enable_if<!std::is_same<bool,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*);
template<typename T>
inline std::string GetPrintableType(
util::ParamData& d,
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0,
const typename boost::disable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0,
const typename std::enable_if<!std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
template<typename T>
inline std::string GetPrintableType(
util::ParamData& /* d */,
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::disable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<!std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
template<typename T>
inline std::string GetPrintableType(
util::ParamData& /* d */,
const typename boost::enable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
const typename std::enable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0);
template<typename T>
inline std::string GetPrintableType(
util::ParamData& d,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0,
const typename boost::disable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
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<data::DatasetInfo, arma::mat>>::value>::type* = 0);
template<typename T>
void GetPrintableType(util::ParamData& d,
@@ -22,11 +22,11 @@ namespace python {
template<typename T>
inline std::string GetPrintableType(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<T>>::type*,
const typename boost::disable_if<data::HasSerialize<T>>::type*,
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
const typename boost::disable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
const typename std::enable_if<!util::IsStdVector<T>::value>::type*,
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
const typename std::enable_if<!std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
{
return "unknown";
}
@@ -34,11 +34,11 @@ inline std::string GetPrintableType(
template<>
inline std::string GetPrintableType<int>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<int>>::type*,
const typename boost::disable_if<data::HasSerialize<int>>::type*,
const typename boost::disable_if<arma::is_arma_type<int>>::type*,
const typename boost::disable_if<std::is_same<int,
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
const typename std::enable_if<!util::IsStdVector<int>::value>::type*,
const typename std::enable_if<!data::HasSerialize<int>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<int>::value>::type*,
const typename std::enable_if<!std::is_same<int,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
{
return "int";
}
@@ -46,11 +46,11 @@ inline std::string GetPrintableType<int>(
template<>
inline std::string GetPrintableType<double>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<double>>::type*,
const typename boost::disable_if<data::HasSerialize<double>>::type*,
const typename boost::disable_if<arma::is_arma_type<double>>::type*,
const typename boost::disable_if<std::is_same<double,
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
const typename std::enable_if<!util::IsStdVector<double>::value>::type*,
const typename std::enable_if<!data::HasSerialize<double>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<double>::value>::type*,
const typename std::enable_if<!std::is_same<double,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
{
return "float";
}
@@ -58,11 +58,11 @@ inline std::string GetPrintableType<double>(
template<>
inline std::string GetPrintableType<std::string>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<std::string>>::type*,
const typename boost::disable_if<data::HasSerialize<std::string>>::type*,
const typename boost::disable_if<arma::is_arma_type<std::string>>::type*,
const typename boost::disable_if<std::is_same<std::string,
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
const typename std::enable_if<!util::IsStdVector<std::string>::value>::type*,
const typename std::enable_if<!data::HasSerialize<std::string>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<std::string>::value>::type*,
const typename std::enable_if<!std::is_same<std::string,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
{
return "str";
}
@@ -70,11 +70,11 @@ inline std::string GetPrintableType<std::string>(
template<>
inline std::string GetPrintableType<size_t>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<size_t>>::type*,
const typename boost::disable_if<data::HasSerialize<size_t>>::type*,
const typename boost::disable_if<arma::is_arma_type<size_t>>::type*,
const typename boost::disable_if<std::is_same<size_t,
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
const typename std::enable_if<!util::IsStdVector<size_t>::value>::type*,
const typename std::enable_if<!data::HasSerialize<size_t>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<size_t>::value>::type*,
const typename std::enable_if<!std::is_same<size_t,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
{
return "int";
}
@@ -82,11 +82,11 @@ inline std::string GetPrintableType<size_t>(
template<>
inline std::string GetPrintableType<bool>(
util::ParamData& /* d */,
const typename boost::disable_if<util::IsStdVector<bool>>::type*,
const typename boost::disable_if<data::HasSerialize<bool>>::type*,
const typename boost::disable_if<arma::is_arma_type<bool>>::type*,
const typename boost::disable_if<std::is_same<bool,
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
const typename std::enable_if<!util::IsStdVector<bool>::value>::type*,
const typename std::enable_if<!data::HasSerialize<bool>::value>::type*,
const typename std::enable_if<!arma::is_arma_type<bool>::value>::type*,
const typename std::enable_if<!std::is_same<bool,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
{
return "bool";
}
@@ -94,9 +94,9 @@ inline std::string GetPrintableType<bool>(
template<typename T>
inline std::string GetPrintableType(
util::ParamData& d,
const typename boost::enable_if<util::IsStdVector<T>>::type*,
const typename boost::disable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
const typename std::enable_if<util::IsStdVector<T>::value>::type*,
const typename std::enable_if<!std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
{
return "list of " + GetPrintableType<typename T::value_type>(d) + "s";
}
@@ -104,9 +104,9 @@ inline std::string GetPrintableType(
template<typename T>
inline std::string GetPrintableType(
util::ParamData& /* d */,
const typename boost::enable_if<arma::is_arma_type<T>>::type*,
const typename boost::disable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
const typename std::enable_if<arma::is_arma_type<T>::value>::type*,
const typename std::enable_if<!std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
{
std::string type = "matrix";
if (std::is_same<typename T::elem_type, double>::value)
@@ -127,8 +127,8 @@ inline std::string GetPrintableType(
template<typename T>
inline std::string GetPrintableType(
util::ParamData& /* d */,
const typename boost::enable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
const typename std::enable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
{
return "categorical matrix";
}
@@ -136,10 +136,10 @@ inline std::string GetPrintableType(
template<typename T>
inline std::string GetPrintableType(
util::ParamData& d,
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
const typename boost::enable_if<data::HasSerialize<T>>::type*,
const typename boost::disable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
const typename std::enable_if<data::HasSerialize<T>::value>::type*,
const typename std::enable_if<!std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
{
return d.cppType + "Type";
}
+5 -5
View File
@@ -26,8 +26,8 @@ template<typename T>
void ImportDecl(
util::ParamData& d,
const size_t indent,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
{
// First, we have to parse the type. If we have something like, e.g.,
// 'LogisticRegression<>', we must convert this to 'LogisticRegression[T=*].'
@@ -53,8 +53,8 @@ template<typename T>
void ImportDecl(
util::ParamData& /* d */,
const size_t /* indent */,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0)
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0)
{
// Print nothing.
}
@@ -66,7 +66,7 @@ template<typename T>
void ImportDecl(
util::ParamData& /* d */,
const size_t /* indent */,
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
{
// Print nothing.
}
@@ -25,8 +25,8 @@ namespace python {
template<typename T>
void PrintClassDefn(
util::ParamData& /* d */,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0)
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0)
{
// Do nothing.
}
@@ -37,7 +37,7 @@ void PrintClassDefn(
template<typename T>
void PrintClassDefn(
util::ParamData& /* d */,
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
{
// Do nothing.
}
@@ -48,8 +48,8 @@ void PrintClassDefn(
template<typename T>
void PrintClassDefn(
util::ParamData& d,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
{
// First, we have to parse the type. If we have something like, e.g.,
// 'LogisticRegression<>', we must convert this to 'LogisticRegression[].'
@@ -31,11 +31,11 @@ template<typename T>
void PrintInputProcessing(
util::ParamData& d,
const size_t indent,
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
const typename boost::disable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
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<data::DatasetInfo, arma::mat>>::value>::type* = 0)
{
// The copy_all_inputs parameter must be handled first, and therefore is
// outside the scope of this code.
@@ -164,11 +164,11 @@ template<typename T>
void PrintInputProcessing(
util::ParamData& d,
const size_t indent,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
const typename boost::disable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0,
const typename boost::enable_if<util::IsStdVector<T>>::type* = 0)
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<data::DatasetInfo, arma::mat>>::value>::type* = 0,
const typename std::enable_if<util::IsStdVector<T>::value>::type* = 0)
{
const std::string prefix(indent, ' ');
@@ -251,8 +251,8 @@ template<typename T>
void PrintInputProcessing(
util::ParamData& d,
const size_t indent,
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
{
const std::string prefix(indent, ' ');
@@ -372,9 +372,9 @@ template<typename T>
void PrintInputProcessing(
util::ParamData& d,
const size_t indent,
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
{
// First, get the correct class name if needed.
std::string strippedType, printedType, defaultsType;
@@ -445,9 +445,9 @@ template<typename T>
void PrintInputProcessing(
util::ParamData& d,
const size_t indent,
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
const typename boost::enable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
const typename std::enable_if<!util::IsStdVector<T>::value>::type* = 0,
const typename std::enable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
{
// The user should pass in a matrix type of some sort.
const std::string prefix(indent, ' ');
@@ -30,10 +30,10 @@ void PrintOutputProcessing(
util::ParamData& d,
const size_t indent,
const bool onlyOutput,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
const typename boost::disable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
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<data::DatasetInfo, arma::mat>>::value>::type* = 0)
{
const std::string prefix(indent, ' ');
@@ -86,7 +86,7 @@ void PrintOutputProcessing(
util::ParamData& d,
const size_t indent,
const bool onlyOutput,
const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
{
const std::string prefix(indent, ' ');
@@ -128,8 +128,8 @@ void PrintOutputProcessing(
util::ParamData& d,
const size_t indent,
const bool onlyOutput,
const typename boost::enable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
const typename std::enable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type* = 0)
{
const std::string prefix(indent, ' ');
@@ -170,8 +170,8 @@ void PrintOutputProcessing(
util::ParamData& d,
const size_t indent,
const bool onlyOutput,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
{
// Get the type names we need to use.
std::string strippedType, printedType, defaultsType;
@@ -25,11 +25,11 @@ namespace python {
template<typename T>
std::string PrintTypeDoc(
util::ParamData& data,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::disable_if<util::IsStdVector<T>>::type* = 0,
const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
const typename boost::disable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0);
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<!util::IsStdVector<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<data::DatasetInfo, arma::mat>>::value>::type* = 0);
/**
* Return a string representing the command-line type of a vector.
@@ -62,8 +62,8 @@ std::string PrintTypeDoc(
template<typename T>
std::string PrintTypeDoc(
util::ParamData& data,
const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
const typename boost::enable_if<data::HasSerialize<T>>::type* = 0);
const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0);
/**
* Print the command-line type of an option into a string.
@@ -24,11 +24,11 @@ namespace python {
template<typename T>
std::string PrintTypeDoc(
util::ParamData& data,
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
const typename boost::disable_if<util::IsStdVector<T>>::type*,
const typename boost::disable_if<data::HasSerialize<T>>::type*,
const typename boost::disable_if<std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>>::type*)
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
const typename std::enable_if<!util::IsStdVector<T>::value>::type*,
const typename std::enable_if<!data::HasSerialize<T>::value>::type*,
const typename std::enable_if<!std::is_same<T,
std::tuple<data::DatasetInfo, arma::mat>>::value>::type*)
{
// A flag type.
if (std::is_same<T, bool>::value)
@@ -150,8 +150,8 @@ std::string PrintTypeDoc(
template<typename T>
std::string PrintTypeDoc(
util::ParamData& /* data */,
const typename boost::disable_if<arma::is_arma_type<T>>::type*,
const typename boost::enable_if<data::HasSerialize<T>>::type*)
const typename std::enable_if<!arma::is_arma_type<T>::value>::type*,
const typename std::enable_if<data::HasSerialize<T>::value>::type*)
{
return "An mlpack model pointer. This type can be pickled to or from disk, "
"and internally holds a pointer to C++ memory containing the mlpack "