Removed naked double * calls
This commit is contained in:
parent
cd1101dfe2
commit
8d01edb7a1
@ -24,14 +24,6 @@ void Layer::setOutputValues(const std::vector<double> & outputValues)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Layer::setOutputValues(const double *outputValues)
|
|
||||||
{
|
|
||||||
for (size_t neuronIndex = 0; neuronIndex < size(); ++neuronIndex)
|
|
||||||
{
|
|
||||||
at(neuronIndex).setOutputValue(outputValues[neuronIndex]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Layer::feedForward(const Layer &inputLayer)
|
void Layer::feedForward(const Layer &inputLayer)
|
||||||
{
|
{
|
||||||
for (size_t neuronNumber = 0; neuronNumber < sizeWithoutBiasNeuron(); ++neuronNumber)
|
for (size_t neuronNumber = 0; neuronNumber < sizeWithoutBiasNeuron(); ++neuronNumber)
|
||||||
|
3
Layer.h
3
Layer.h
@ -13,11 +13,10 @@ public:
|
|||||||
Layer(size_t numNeurons);
|
Layer(size_t numNeurons);
|
||||||
|
|
||||||
void setOutputValues(const std::vector<double> & outputValues);
|
void setOutputValues(const std::vector<double> & outputValues);
|
||||||
void setOutputValues(const double *outputValues);
|
|
||||||
|
|
||||||
void feedForward(const Layer &inputLayer);
|
void feedForward(const Layer &inputLayer);
|
||||||
double getWeightedSum(size_t outputNeuron) const;
|
double getWeightedSum(size_t outputNeuron) const;
|
||||||
void connectTo(const Layer & nextLayer);
|
void connectTo(const Layer &nextLayer);
|
||||||
|
|
||||||
void updateInputWeights(Layer &prevLayer);
|
void updateInputWeights(Layer &prevLayer);
|
||||||
|
|
||||||
|
15
Net.cpp
15
Net.cpp
@ -66,21 +66,6 @@ void Net::feedForward(const std::vector<double> &inputValues)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Net::feedForward(const double *inputValues)
|
|
||||||
{
|
|
||||||
Layer &inputLayer = front();
|
|
||||||
|
|
||||||
inputLayer.setOutputValues(inputValues);
|
|
||||||
|
|
||||||
for (auto layerIt = begin(); layerIt != end() - 1; ++layerIt)
|
|
||||||
{
|
|
||||||
const Layer ¤tLayer = *layerIt;
|
|
||||||
Layer &nextLayer = *(layerIt + 1);
|
|
||||||
|
|
||||||
nextLayer.feedForward(currentLayer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<double> Net::getOutput()
|
std::vector<double> Net::getOutput()
|
||||||
{
|
{
|
||||||
std::vector<double> result;
|
std::vector<double> result;
|
||||||
|
1
Net.h
1
Net.h
@ -15,7 +15,6 @@ public:
|
|||||||
void initialize(std::initializer_list<size_t> layerSizes);
|
void initialize(std::initializer_list<size_t> layerSizes);
|
||||||
|
|
||||||
void feedForward(const std::vector<double> &inputValues);
|
void feedForward(const std::vector<double> &inputValues);
|
||||||
void feedForward(const double *inputValues);
|
|
||||||
std::vector<double> getOutput();
|
std::vector<double> getOutput();
|
||||||
void backProp(const std::vector<double> &targetValues);
|
void backProp(const std::vector<double> &targetValues);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user