mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-06 01:34:22 +00:00
Change model input layer creation
This commit is contained in:
@@ -19,6 +19,8 @@ class Model {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Layers::Input *inputLayer;
|
||||||
|
|
||||||
int inputSize;
|
int inputSize;
|
||||||
int inputChannels;
|
int inputChannels;
|
||||||
|
|
||||||
|
|||||||
@@ -12,19 +12,20 @@ Model::Model(const int inputSize, const int inputChannels)
|
|||||||
|
|
||||||
|
|
||||||
const int inputLayerSize = inputSize * inputSize * inputChannels;
|
const int inputLayerSize = inputSize * inputSize * inputChannels;
|
||||||
Layers::Input* inputLayer = new Layers::Input(inputLayerSize);
|
inputLayer = new Layers::Input(inputLayerSize);
|
||||||
|
|
||||||
layers.push_back(inputLayer);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Model::~Model(){};
|
Model::~Model(){};
|
||||||
|
|
||||||
float* Model::predict(const float* input) {
|
float* Model::predict(const float* input) {
|
||||||
|
|
||||||
|
float* d_input = inputLayer->forward(input);
|
||||||
|
|
||||||
for (auto& layer : layers) {
|
for (auto& layer : layers) {
|
||||||
input = layer->forward(input);
|
d_input = layer->forward(d_input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return d_input;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Model::addLayer(const std::string& name, Layers::SequentialLayer* layer) {
|
void Model::addLayer(const std::string& name, Layers::SequentialLayer* layer) {
|
||||||
|
|||||||
Reference in New Issue
Block a user