[mlpack-git] [mlpack/mlpack] Inception layer (#757)
Tham
notifications at github.com
Sun Aug 14 08:43:38 EDT 2016
> + {
> + ForwardTail(layers, output);
> + }
> +
> + template<size_t I = 0, typename DataType, typename... Tp>
> + typename std::enable_if<I == sizeof...(Tp), void>::type
> + ForwardTail(std::tuple<Tp...>& layers, DataType& output)
> + {
> + /* Nothing to do. */
> + }
> +
> + template<size_t I = 0, typename DataType, typename... Tp>
> + typename std::enable_if<I < sizeof...(Tp), void>::type
> + ForwardTail(std::tuple<Tp...>& layers, DataType& output)
> + {
> + output = arma::join_slices(output, std::get<I>(layers).OutputParameter());
>but i can write 2 overloads for output type arma::cube and arma::mat.
I think this is a good solution.
>Is there a better way ?
I do not know a better way, but it is possible to specialize your function by std::enable_if, you can write something like
```
//pseudo codes
typename std::enable_if<I < sizeof...(Tp) & std::is_arma_mat<DataType>::value>::type
```
Armadillo has a header file define something like std::is_arma_mat, but I forgot where is it. However, this solution is less elegant compare with overload.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/757/files/06d923321f246f2c6ead9ad56e99309fe24a6f5c#r74701138
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160814/2a9ffb99/attachment.html>
More information about the mlpack-git
mailing list