Skip to content

Commit

Permalink
changing a constructor to support copy
Browse files Browse the repository at this point in the history
  • Loading branch information
theSundayProgrammer committed Mar 2, 2016
1 parent ac67380 commit 540dd7c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/mlpack/methods/ann/cnn.hpp
Expand Up @@ -102,9 +102,9 @@ class CNN
* @param performanceFunction Optional instantiated PerformanceFunction
* object used to claculate the error.
*/
template<typename LayerType, typename OutputType>
CNN(LayerType &&network,
OutputType &&outputLayer,

CNN(LayerTypes const &network,
OutputLayerType const &outputLayer,
InitializationRuleType initializeRule = InitializationRuleType(),
PerformanceFunction performanceFunction = PerformanceFunction());
/**
Expand Down Expand Up @@ -407,7 +407,7 @@ class CNN
LayerTypes network;

//! The outputlayer used to evaluate the network
OutputLayerType& outputLayer;
OutputLayerType outputLayer;

//! Performance strategy used to claculate the error.
PerformanceFunction performanceFunc;
Expand Down
17 changes: 5 additions & 12 deletions src/mlpack/methods/ann/cnn_impl.hpp
Expand Up @@ -94,23 +94,16 @@ template<typename LayerTypes,
typename InitializationRuleType,
typename PerformanceFunction
>
template<typename LayerType, typename OutputType>
CNN<LayerTypes, OutputLayerType, InitializationRuleType, PerformanceFunction
>::CNN(LayerType &&network,
OutputType &&outputLayer,
>::CNN(LayerTypes const &network_,
OutputLayerType const &outputLayer_,
InitializationRuleType initializeRule,
PerformanceFunction performanceFunction) :
network(std::forward<LayerType>(network)),
outputLayer(std::forward<OutputType>(outputLayer)),
performanceFunc(std::move(performanceFunction))
network(network_),
outputLayer(outputLayer_),
performanceFunc(performanceFunction)
{
static_assert(std::is_same<typename std::decay<LayerType>::type,
LayerTypes>::value,
"The type of network must be LayerTypes.");

static_assert(std::is_same<typename std::decay<OutputType>::type,
OutputLayerType>::value,
"The type of outputLayer must be OutputLayerType.");

initializeRule.Initialize(parameter, NetworkSize(network), 1);
NetworkWeights(parameter, network);
Expand Down

0 comments on commit 540dd7c

Please sign in to comment.