Skip to content

Commit 50e306e

Browse files
authored
Create conv_dw_layer.hpp
1 parent 566ac69 commit 50e306e

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

conv_dw_layer.hpp

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#ifndef CAFFE_CONV_DW_LAYER_HPP_
2+
#define CAFFE_CONV_DW_LAYER_HPP_
3+
4+
#include <vector>
5+
#include "caffe/blob.hpp"
6+
#include "caffe/layer.hpp"
7+
#include "caffe/proto/caffe.pb.h"
8+
9+
namespace caffe {
10+
11+
template <typename Dtype>
12+
class ConvolutionDepthwiseLayer : public Layer<Dtype> {
13+
public:
14+
explicit ConvolutionDepthwiseLayer(const LayerParameter& param)
15+
: Layer<Dtype>(param) {}
16+
virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
17+
const vector<Blob<Dtype>*>& top);
18+
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
19+
const vector<Blob<Dtype>*>& top);
20+
virtual inline int ExactNumBottomBlobs() const { return 1; }
21+
virtual inline int ExactNumTopBlobs() const { return 1; }
22+
virtual inline const char* type() const { return "ConvolutionDepthwise"; }
23+
protected:
24+
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
25+
const vector<Blob<Dtype>*>& top);
26+
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
27+
const vector<Blob<Dtype>*>& top);
28+
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
29+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
30+
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
31+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
32+
unsigned int kernel_h_;
33+
unsigned int kernel_w_;
34+
unsigned int stride_h_;
35+
unsigned int stride_w_;
36+
unsigned int pad_h_;
37+
unsigned int pad_w_;
38+
unsigned int dilation_h_;
39+
unsigned int dilation_w_;
40+
Blob<Dtype> weight_buffer_;
41+
Blob<Dtype> weight_multiplier_;
42+
Blob<Dtype> bias_buffer_;
43+
Blob<Dtype> bias_multiplier_;
44+
};
45+
46+
} // namespace caffe
47+
48+
#endif // CAFFE_CONV_DW_LAYER_HPP_

0 commit comments

Comments
 (0)