tweaking speed
This commit is contained in:
@@ -20,7 +20,7 @@ namespace FeedForward {
|
||||
* @brief Constructor for Network
|
||||
* @param _inputSize is number of inputs to network
|
||||
*/
|
||||
inline Network(size_t _inputSize):NeuralNetwork::Network(_inputSize,_inputSize),layers() {
|
||||
inline Network(size_t _inputSize):NeuralNetwork::Network(_inputSize,_inputSize),layers(),_partialInput(_inputSize),_partialOutput(_inputSize) {
|
||||
appendLayer(_inputSize);
|
||||
};
|
||||
|
||||
@@ -42,9 +42,17 @@ namespace FeedForward {
|
||||
_inputs=size;
|
||||
}
|
||||
|
||||
if(_partialInput.size() < size+1) {
|
||||
_partialInput.resize(size+1);
|
||||
}
|
||||
|
||||
if(_partialOutput.size() < size+1) {
|
||||
_partialOutput.resize(size+1);
|
||||
}
|
||||
|
||||
_outputs=size;
|
||||
|
||||
return *layers[layers.size()-1];//.back();
|
||||
return *layers.back();
|
||||
}
|
||||
|
||||
Layer& operator[](const std::size_t &id) {
|
||||
@@ -80,6 +88,8 @@ namespace FeedForward {
|
||||
|
||||
protected:
|
||||
std::vector<Layer*> layers;
|
||||
std::vector<float> _partialInput = {};
|
||||
std::vector<float> _partialOutput = {};
|
||||
|
||||
private:
|
||||
inline Network():NeuralNetwork::Network(0,0),layers() {
|
||||
|
||||
Reference in New Issue
Block a user