-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathBaseParam.h
More file actions
32 lines (27 loc) · 899 Bytes
/
BaseParam.h
File metadata and controls
32 lines (27 loc) · 899 Bytes
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
/*
* BaseParam.h
*
* Created on: Jul 25, 2016
* Author: mason
*/
#ifndef BasePARAM_H_
#define BasePARAM_H_
#include "MyTensor.h"
struct BaseParam {
Tensor2D val;
Tensor2D grad;
public:
virtual inline void initial(int outDim, int inDim) = 0;
virtual inline void updateAdagrad(dtype alpha, dtype reg, dtype eps) = 0;
virtual inline void updateAdam(dtype belta1, dtype belta2, dtype alpha, dtype reg, dtype eps) = 0;
virtual inline int outDim() = 0;
virtual inline int inDim() = 0;
virtual inline void clearGrad() = 0;
// Choose one point randomly
virtual inline void randpoint(int& idx, int &idy) = 0;
virtual inline dtype squareGradNorm() = 0;
virtual inline void rescaleGrad(dtype scale) = 0;
virtual inline void save(std::ofstream &os)const = 0;
virtual inline void load(std::ifstream &is) = 0;
};
#endif /* BasePARAM_H_ */