-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadddense.cpp
55 lines (49 loc) · 1.71 KB
/
adddense.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "adddense.h"
#include "ui_adddense.h"
AddDense::AddDense(QWidget *parent) :
QDialog(parent),
ui(new Ui::AddDense)
{
ui->setupUi(this);
}
AddDense::AddDense(Apollo::Dataloader* data, Apollo::Model* model, QWidget *parent) :
QDialog(parent),
ui(new Ui::AddDense)
{
ui->setupUi(this);
this->data = data;
this->model = model;
if(model->getLastLayerOutputShape()[0] == 0 && this->model->getLastLayerOutputShape()[1] == 0){
lastShape = this->data->getTrainDataShape();
}else{
lastShape = this->model->getLastLayerOutputShape();
}
ui->inputs->setPlainText(QString::number(lastShape[0]));
ui->outputs->setPlainText(QString::number(lastShape[1]));
// cout<<this->model->getLastLayerOutputShape()[0]<< " " << this->model->getLastLayerOutputShape()[1] << endl;
}
AddDense::~AddDense()
{
delete ui;
}
void AddDense::on_pushButton_clicked()
{
int numNeurons = ui->neurons->toPlainText().toInt();
int numInputs = ui->inputs->toPlainText().toInt();
int numOutputs = ui->outputs->toPlainText().toInt();
int shape[2]={numInputs, numOutputs};
Apollo::MultiType Dense = Apollo::Dense(numNeurons, shape);
this->model->addLayer(&Dense);
close();
// cout<<this->model->getLastLayerOutputShape()[0]<< " " << this->model->getLastLayerOutputShape()[1] << endl;
}
void AddDense::on_pushButton_2_clicked()
{
if(model->getLastLayerOutputShape()[0] == 0 and this->model->getLastLayerOutputShape()[1]){
lastShape = this->data->getTrainDataShape();
}else{
lastShape = this->model->getLastLayerOutputShape();
}
ui->inputs->setPlainText(QString::number(lastShape[0]));
ui->outputs->setPlainText(QString::number(lastShape[1]));
}