eac15651d1a68221707bb22d848b119c6927c8dd
[platform/upstream/caffeonacl.git] / src / caffe / layers / acl_sigmoid_layer.cpp
1 #ifdef USE_ACL
2 #include <vector>
3
4 #include "caffe/layers/acl_sigmoid_layer.hpp"
5
6 namespace caffe {
7
8 template <typename Dtype>
9 void ACLSigmoidLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
10       const vector<Blob<Dtype>*>& top) {
11   SigmoidLayer<Dtype>::LayerSetUp(bottom, top);
12   ACLBaseActivationLayer<Dtype>::LayerSetUp(bottom, top);
13   this->force_bypass_acl_path_= bypass_acl_class_layer & FLAGS_ENABLE_ACL_SIGMOID;
14 }
15
16 template <typename Dtype>
17 void ACLSigmoidLayer<Dtype>::SetupACLLayer(const vector<Blob<Dtype>*>& bottom,
18       const vector<Blob<Dtype>*>& top,ActivationLayerInfo::ActivationFunction type){
19     ACLBaseActivationLayer<Dtype>::SetupACLLayer(bottom, top,ActivationLayerInfo::ActivationFunction::LOGISTIC);
20 }
21 template <typename Dtype>
22 void ACLSigmoidLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,
23       const vector<Blob<Dtype>*>& top) {
24   SigmoidLayer<Dtype>::Reshape(bottom, top);
25   ACLBaseActivationLayer<Dtype>::Reshape(bottom, top);
26 }
27
28 template <typename Dtype>
29 void ACLSigmoidLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
30     const vector<Blob<Dtype>*>& top) {
31 #ifdef USE_PROFILING
32     logtime_util log_time(ACL_SIGMOID_INFO);
33 #endif //USE_PROFILING
34     if (this->force_bypass_acl_path_) {
35         SigmoidLayer<Dtype>::Forward_cpu(bottom,top);
36         return;
37     }
38     ACLBaseActivationLayer<Dtype>::Forward_cpu(bottom,top);
39 }
40
41 template <typename Dtype>
42 void ACLSigmoidLayer<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom,
43     const vector<Blob<Dtype>*>& top) {
44 #ifdef USE_PROFILING
45     logtime_util log_time(ACL_SIGMOID_INFO);
46 #endif //USE_PROFILING
47     if (this->force_bypass_acl_path_) {
48         SigmoidLayer<Dtype>::Forward_cpu(bottom,top);
49         return;
50     }
51     ACLBaseActivationLayer<Dtype>::Forward_gpu(bottom,top);
52 }
53
54 template <typename Dtype>
55 ACLSigmoidLayer<Dtype>::~ACLSigmoidLayer() {
56 }
57
58 INSTANTIATE_CLASS(ACLSigmoidLayer);
59
60 }  // namespace caffe
61 #endif // USE_ACL