-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdenseam.h
55 lines (49 loc) · 1.86 KB
/
denseam.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
#ifndef DENSEAM_H_
#define DENSEAM_H_
#include <unsupported/Eigen/CXX11/Tensor>
#include "approx_mul_lut.h"
template <typename Device, typename T>
struct DenseamFunctor {
void operator()(const Device& d, const T* inputs, const T* weights, T* output,
const int batch, const int units, const int input_width,
approx_mul_lut<Device>& mul_lut
);
};
template <typename Device, typename T>
struct DenseamWeightGradFunctor{
void operator()(const Device& d, const T* input, const T* grads,
T* output, const int batch, const int units, const int input_width,
approx_mul_lut<Device>& mul_lut
);
};
template <typename Device, typename T>
struct DenseamInputGradFunctor{
void operator()(const Device& d, const T* weight, const T* grads,
T* output, const int batch, const int units, const int input_width,
approx_mul_lut<Device>& mul_lut
);
};
#if GOOGLE_CUDA
template <typename T>
struct DenseamFunctor<Eigen::GpuDevice, T> {
void operator()(const Eigen::GpuDevice& d, const T* inputs, const T* weights,
T* output, const int batch, const int units, const int input_width,
approx_mul_lut<Eigen::GpuDevice>& mul_lut
);
};
template <typename T>
struct DenseamWeightGradFunctor<Eigen::GpuDevice, T>{
void operator()(const Eigen::GpuDevice& d, const T* input, const T* grads,
T* output, const int batch, const int units, const int input_width,
approx_mul_lut<Eigen::GpuDevice>& mul_lut
);
};
template <typename T>
struct DenseamInputGradFunctor<Eigen::GpuDevice, T>{
void operator()(const Eigen::GpuDevice& d, const T* weight, const T* grads,
T* output, const int batch, const int units, const int input_width,
approx_mul_lut<Eigen::GpuDevice>& mul_lut
);
};
#endif
#endif