4 #include "caffe/layers/acl_absval_layer.hpp"
5 #include "caffe/util/math_functions.hpp"
9 template <typename Dtype>
10 void ACLAbsValLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
11 const vector<Blob<Dtype>*>& top) {
12 AbsValLayer<Dtype>::LayerSetUp(bottom, top);
13 ACLBaseActivationLayer<Dtype>::LayerSetUp(bottom, top);
14 this->force_bypass_acl_path_= bypass_acl_class_layer & FLAGS_ENABLE_ACL_ABSVAL;
17 template <typename Dtype>
18 void ACLAbsValLayer<Dtype>::SetupACLLayer(const vector<Blob<Dtype>*>& bottom,
19 const vector<Blob<Dtype>*>& top,ActivationLayerInfo::ActivationFunction type){
20 ACLBaseActivationLayer<Dtype>::SetupACLLayer(bottom, top,ActivationLayerInfo::ActivationFunction::ABS);
23 template <typename Dtype>
24 void ACLAbsValLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,
25 const vector<Blob<Dtype>*>& top) {
26 AbsValLayer<Dtype>::Reshape(bottom, top);
27 ACLBaseActivationLayer<Dtype>::Reshape(bottom, top);
30 template <typename Dtype>
31 void ACLAbsValLayer<Dtype>::Forward_cpu(
32 const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) {
34 logtime_util log_time(ACL_ABSVAL_INFO);
35 #endif //USE_PROFILING
36 if (this->force_bypass_acl_path_) {
37 AbsValLayer<Dtype>::Forward_cpu(bottom,top);
40 ACLBaseActivationLayer<Dtype>::Forward_cpu(bottom,top);
43 template <typename Dtype>
44 void ACLAbsValLayer<Dtype>::Forward_gpu(
45 const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) {
47 logtime_util log_time(ACL_ABSVAL_INFO);
48 #endif //USE_PROFILING
49 if (this->force_bypass_acl_path_) {
50 AbsValLayer<Dtype>::Forward_cpu(bottom,top);
53 ACLBaseActivationLayer<Dtype>::Forward_gpu(bottom,top);
56 template <typename Dtype>
57 ACLAbsValLayer<Dtype>::~ACLAbsValLayer() {
60 INSTANTIATE_CLASS(ACLAbsValLayer);