-
Notifications
You must be signed in to change notification settings - Fork 0
/
Kernel.hpp
65 lines (57 loc) · 1.69 KB
/
Kernel.hpp
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
//
// Kernel.hpp
// TimC
//
// Created by Nima Mohammadi
// Copyright © 2016 Nima Mohammadi. All rights reserved.
//
#ifndef Kernel_hpp
#define Kernel_hpp
#include <stdio.h>
#include <string>
#include <vector>
#include "GaborLayer.hpp"
#include "Eigen/Dense"
#include "SpikeData.hpp"
#include "common.hpp"
//#include "Eigen/StdVector"
class Kernel{
public:
std::string Name;
int NumberOfFeature;
std::vector<std::vector<Eigen::MatrixXf>> Weights;
int CRF;
int SRF;
int centerRow;
int centerCol;
int CStride;
float Threshold;
std::vector<float> InhibitionsPercent;
int KWTA;
float Ap;
float An;
Kernel();
Kernel(std::string, int, int, int, int, int, std::vector<float>, float, int, float, float, float, float);
void TrainKernel(SpikeVec1D&, SpikeVec4D&);
SpikeVec1D TestKernel(SpikeVec1D&, SpikeVec4D&, SpikeVec4D&, bool);
template <class Archive>
void save(Archive & ar) const
{
ar(Name, NumberOfFeature, Weights, CRF, SRF, centerRow, centerCol, CStride, Threshold, InhibitionsPercent, KWTA, Ap, An, sOffset, cOffset, iOffset);
}
template <class Archive>
void load( Archive & ar )
{
ar(Name, NumberOfFeature, Weights, CRF, SRF, centerRow, centerCol, CStride, Threshold, InhibitionsPercent, KWTA, Ap, An, sOffset, cOffset, iOffset);
}
private:
int sOffset;
int cOffset;
int iOffset;
SpikeVec4D GetPooledInhibitedTimes(const SpikeVec4D&);
float getWeight(int, int, int, int);
void ApplySTDP(int, int, int, SpikeVec3D&, std::shared_ptr<SpikeData>);
void increaseWeight(int, int, int, int);
void decreaseWeight(int, int, int, int);
};
#endif /* Kernel_hpp */