Merge pull request #527 from stereomatchingkiss/remove_move_implement

Remove move implement.
This commit is contained in:
Marcus Edel
2016-02-29 21:43:56 +01:00
12 changed files with 32 additions and 163 deletions
+1 -21
View File
@@ -69,27 +69,7 @@ class ConvLayer
{
weights.set_size(wfilter, hfilter, inMaps * outMaps);
}
ConvLayer(ConvLayer &&layer) noexcept
{
*this = std::move(layer);
}
ConvLayer& operator=(ConvLayer &&layer) noexcept
{
wfilter = layer.wfilter;
hfilter = layer.hfilter;
inMaps = layer.inMaps;
outMaps = layer.outMaps;
xStride = layer.xStride;
yStride = layer.yStride;
wPad = layer.wPad;
hPad = layer.hPad;
weights.swap(layer.weights);
return *this;
}
/**
* Ordinary feed forward pass of a neural network, evaluating the function
* f(x) by propagating the activity forward through f.
+1 -17
View File
@@ -64,23 +64,7 @@ class DropoutLayer
rescale(rescale)
{
// Nothing to do here.
}
DropoutLayer(DropoutLayer &&layer) noexcept
{
*this = std::move(layer);
}
DropoutLayer& operator=(DropoutLayer &&layer) noexcept
{
mask.swap(layer.mask);
ratio = layer.ratio;
scale = layer.scale;
deterministic = layer.deterministic;
rescale = layer.rescale;
return *this;
}
}
/**
* Ordinary feed forward pass of the dropout layer.
@@ -42,20 +42,6 @@ class LinearLayer
{
weights.set_size(outSize, inSize);
}
LinearLayer(LinearLayer &&layer) noexcept
{
*this = std::move(layer);
}
LinearLayer& operator=(LinearLayer &&layer) noexcept
{
inSize = layer.inSize;
outSize = layer.outSize;
weights.swap(layer.weights);
return *this;
}
/**
* Ordinary feed forward pass of a neural network, evaluating the function
+1 -16
View File
@@ -59,22 +59,7 @@ class LSTMLayer
peepholeWeights.set_size(outSize, 3);
peepholeDerivatives = arma::zeros<OutputDataType>(outSize, 3);
}
}
LSTMLayer(LSTMLayer &&layer) noexcept
{
*this = std::move(layer);
}
LSTMLayer& operator=(LSTMLayer &&layer) noexcept
{
outSize = layer.outSize;
seqLen = layer.seqLen;
peepholeWeights.swap(layer.peepholeWeights);
return *this;
}
}
/**
* Ordinary feed forward pass of a neural network, evaluating the function
@@ -61,6 +61,14 @@ class MulticlassClassificationLayer
{
output = inputActivations;
}
/**
* Serialize the layer
*/
template<typename Archive>
void Serialize(Archive& ar, const unsigned int /* version */)
{
}
}; // class MulticlassClassificationLayer
//! Layer traits for the multiclass classification layer.
@@ -62,6 +62,14 @@ class OneHotLayer
inputActivations.max(maxIndex);
output(maxIndex) = 1;
}
/**
* Serialize the layer
*/
template<typename Archive>
void Serialize(Archive& ar, const unsigned int /* version */)
{
}
}; // class OneHotLayer
//! Layer traits for the one-hot class classification layer.
+9 -17
View File
@@ -43,23 +43,7 @@ class PoolingLayer
kSize(kSize), pooling(pooling)
{
// Nothing to do here.
}
PoolingLayer(PoolingLayer &&layer) noexcept
{
*this = std::move(layer);
}
PoolingLayer& operator=(PoolingLayer &&layer) noexcept
{
kSize = layer.kSize;
delta.swap(layer.delta);
inputParameter.swap(layer.inputParameter);
outputParameter.swap(layer.outputParameter);
pooling = std::move(layer.pooling);
return *this;
}
}
/**
* Ordinary feed forward pass of a neural network, evaluating the function
@@ -162,6 +146,14 @@ class PoolingLayer
OutputDataType& Delta() const { return delta; }
//! Modify the delta.
OutputDataType& Delta() { return delta; }
/**
* Serialize the layer
*/
template<typename Archive>
void Serialize(Archive& ar, const unsigned int /* version */)
{
}
private:
/**
@@ -55,21 +55,7 @@ class RecurrentLayer
recurrentParameter(arma::zeros<InputDataType>(outSize, 1))
{
weights.set_size(outSize, inSize);
}
RecurrentLayer(RecurrentLayer &&layer) noexcept
{
*this = std::move(layer);
}
RecurrentLayer& operator=(RecurrentLayer &&layer) noexcept
{
inSize = layer.inSize;
outSize = layer.outSize;
weights.swap(layer.weights);
return *this;
}
}
/**
* Ordinary feed forward pass of a neural network, evaluating the function
+1 -15
View File
@@ -34,21 +34,7 @@ class SoftmaxLayer
SoftmaxLayer()
{
// Nothing to do here.
}
SoftmaxLayer(SoftmaxLayer &&layer) noexcept
{
*this = std::move(layer);
}
SoftmaxLayer& operator=(SoftmaxLayer &&layer) noexcept
{
delta.swap(layer.delta);
inputParameter.swap(layer.inputParameter);
outputParameter.swap(layer.outputParameter);
return *this;
}
}
/**
* Ordinary feed forward pass of a neural network, evaluating the function
@@ -42,21 +42,7 @@ class SparseBiasLayer
batchSize(batchSize)
{
weights.set_size(outSize, 1);
}
SparseBiasLayer(SparseBiasLayer &&layer) noexcept
{
*this = std::move(layer);
}
SparseBiasLayer& operator=(SparseBiasLayer &&layer) noexcept
{
outSize = layer.outSize;
batchSize = layer.batchSize;
weights.swap(layer.weights);
return *this;
}
}
/**
* Ordinary feed forward pass of a neural network, evaluating the function
@@ -47,22 +47,7 @@ class SparseInputLayer
lambda(lambda)
{
weights.set_size(outSize, inSize);
}
SparseInputLayer(SparseInputLayer &&layer) noexcept
{
*this = std::move(layer);
}
SparseInputLayer& operator=(SparseInputLayer &&layer) noexcept
{
inSize = layer.inSize;
outSize = layer.outSize;
lambda = layer.lambda;
weights.swap(layer.weights);
return *this;
}
}
/**
* Ordinary feed forward pass of a neural network, evaluating the function
@@ -49,23 +49,6 @@ class SparseOutputLayer
weights.set_size(outSize, inSize);
}
SparseOutputLayer(SparseOutputLayer &&layer) noexcept
{
*this = std::move(layer);
}
SparseOutputLayer& operator=(SparseOutputLayer &&layer) noexcept
{
beta = layer.beta;
rho = layer.rho;
lambda = layer.lambda;
inSize = layer.inSize;
outSize = layer.outSize;
weights.swap(layer.weights);
return *this;
}
/**
* Ordinary feed forward pass of a neural network, evaluating the function
* f(x) by propagating the activity forward through f.