mlpack 3.4.2
get_allocated_memory.hpp
Go to the documentation of this file.
1
13#ifndef MLPACK_BINDINGS_CLI_GET_ALLOCATED_MEMORY_HPP
14#define MLPACK_BINDINGS_CLI_GET_ALLOCATED_MEMORY_HPP
15
17
18namespace mlpack {
19namespace bindings {
20namespace cli {
21
22template<typename T>
24 util::ParamData& /* d */,
25 const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
26 const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0)
27{
28 return NULL;
29}
30
31template<typename T>
33 util::ParamData& /* d */,
34 const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
35{
36 return NULL;
37}
38
39template<typename T>
42 const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
43 const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
44{
45 // Here we have a model, which is a tuple, and we need the address of the
46 // memory.
47 typedef std::tuple<T*, std::string> TupleType;
48 return std::get<0>(*boost::any_cast<TupleType>(&d.value));
49}
50
51template<typename T>
53 const void* /* input */,
54 void* output)
55{
56 *((void**) output) =
57 GetAllocatedMemory<typename std::remove_pointer<T>::type>(d);
58}
59
60} // namespace cli
61} // namespace bindings
62} // namespace mlpack
63
64#endif
void * GetAllocatedMemory(util::ParamData &, const typename boost::disable_if< data::HasSerialize< T > >::type *=0, const typename boost::disable_if< arma::is_arma_type< T > >::type *=0)
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
This structure holds all of the information about a single parameter, including its value (which is s...
Definition: param_data.hpp:53
boost::any value
The actual value that is held.
Definition: param_data.hpp:82