-
Notifications
You must be signed in to change notification settings - Fork 1
/
datainfo.h
58 lines (51 loc) · 1.62 KB
/
datainfo.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
#pragma once
#include <iostream>
#include <assert.h>
#define PAD_VALID 0
#define PAD_SAME 1
#define MAXPOOL 0
#define AVGPOOL 1
#define NCHW 0
#define NHWC 1
namespace cnn
{
struct DataInfo
{
~DataInfo();
void deallocate(std::string key);
void allocate(std::string key, size_t data_size);
bool isValid(std::string key) const;
void setVal(std::string key, float val = 1.f);
void print(std::string key, int n = 25) const;
void NHWC2NCHW(size_t data_size, const float* inp_data);
//Layer data
std::string mLayerName{""};
std::string mLayerType{""};
//Kernel & Bias data
size_t mKernelDataSize;
size_t mBiasDataSize;
char* mpKernelData{ NULL };
char* mpBiasData{ NULL };
bool isKernelValid = false;
bool isBiasValid = false;
//Input parameters (Kernel input shape
int mInput_h{ -1 };
int mInput_w{ -1 };
//Kernel parameters
int mPadType{PAD_VALID};
int mPoolType{MAXPOOL};
int mN{ -1 };
int mC{ -1 };
int mkernel_h{ -1 };
int mkernel_w{ -1 };
int mpad_h{ -1 };
int mpad_w{ -1 };
int mstride_h{ -1 };
int mstride_w{ -1 };
int mbias_term{ -1 };
int mdilation_h{ -1 };
int mdilation_w{ -1 };
int mgroup{ -1 }; //not supported yet in TF
int mData_Format {NHWC};
};
}