mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-05 17:34:21 +00:00
Change model input layer creation
This commit is contained in:
@@ -19,6 +19,8 @@ class Model {
|
||||
|
||||
private:
|
||||
|
||||
Layers::Input *inputLayer;
|
||||
|
||||
int inputSize;
|
||||
int inputChannels;
|
||||
|
||||
|
||||
@@ -12,19 +12,20 @@ Model::Model(const int inputSize, const int inputChannels)
|
||||
|
||||
|
||||
const int inputLayerSize = inputSize * inputSize * inputChannels;
|
||||
Layers::Input* inputLayer = new Layers::Input(inputLayerSize);
|
||||
|
||||
layers.push_back(inputLayer);
|
||||
inputLayer = new Layers::Input(inputLayerSize);
|
||||
};
|
||||
|
||||
Model::~Model(){};
|
||||
|
||||
float* Model::predict(const float* input) {
|
||||
|
||||
float* d_input = inputLayer->forward(input);
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user