-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathConvLayers.h
73 lines (66 loc) · 1.63 KB
/
ConvLayers.h
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// ConvLayers.h
// ConvNet
//
// Created by Márton Szemenyei on 2017. 09. 28..
// Copyright © 2017. Márton Szemenyei. All rights reserved.
//
#ifndef ConvLayers_h
#define ConvLayers_h
#include "Layer.h"
#include "Utils.h"
class ConvLayer : public Layer
{
private:
float *weights;
float *bias;
Tuple size;
Tuple stride;
Tuple padding;
Tuple dilation;
bool hasBias;
int32_t *lut;
public:
ConvLayer(int32_t _h, int32_t _w, int32_t _inCh, int32_t _outCh, Tuple _size, Tuple _stride, Tuple _padding, Tuple _dilation, ACTIVATION _activation, bool _hasBias);
~ConvLayer();
void forward();
bool HasBias();
int32_t getWorkSpaceSize();
bool loadWeights( std::ifstream &file );
void print();
};
class TransposedConvLayer : public Layer
{
private:
float *weights;
float *bias;
Tuple size;
Tuple stride;
Tuple padding;
int32_t outPadding;
bool hasBias;
public:
TransposedConvLayer(int32_t _h, int32_t _w, int32_t _inCh, int32_t _outCh, Tuple _size, Tuple _stride, Tuple _padding, int32_t _outPadding, ACTIVATION _activation, bool _hasBias);
~TransposedConvLayer();
void forward();
bool HasBias();
int32_t getWorkSpaceSize();
bool loadWeights( std::ifstream &file );
void print();
};
class FCLayer : public Layer
{
private:
float *weights;
float *bias;
bool hasBias;
public:
FCLayer(int32_t _inCh, int32_t _outCh, ACTIVATION _activation, bool _hasBias);
FCLayer();
void forward();
bool HasBias();
int32_t getWorkSpaceSize();
bool loadWeights( std::ifstream &file );
void print();
};
#endif /* ConvLayers_h */