clDNN
activation.hpp
1 /*
2 // Copyright (c) 2016 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16 
18 #pragma once
19 #include "../C/activation.h"
20 #include "primitive.hpp"
21 
22 namespace cldnn
23 {
30 
39 struct activation : public primitive_base<activation, CLDNN_PRIMITIVE_DESC(activation)>
40 {
41  CLDNN_DECLATE_PRIMITIVE(activation)
42 
43 
44  activation(
49  const primitive_id& id,
50  const primitive_id& input,
53  const padding& output_padding = padding()
54  )
59  {
60  }
61 
69  const primitive_id& id,
70  const primitive_id& input,
73  const padding& output_padding = padding()
74  )
77  , additional_params({ 0,0 })
79  {
80  }
81 
83  activation(const dto* dto)
88  {
89  }
90 
93 
96 
101 
102 protected:
103 
104  std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override
105  {
106  if (additional_params_input.empty())
107  return{};
108  return{ additional_params_input };
109  }
110 
111  void update_dto(dto& dto) const override
112  {
113  dto.activation_func = activation_func;
114  dto.additional_params = additional_params;
115  dto.additional_params_input = additional_params_input.c_str();
116  }
117 };
121 }
primitive_id additional_params_input
PRelu activation slope input primitive id. Input x dimension should be equal to input feature size (o...
Definition: activation.hpp:100
Represents data padding information.
Definition: layout.hpp:125
Activation using rectified linear unit or parameterized rectified linear unit.
Definition: activation.hpp:39
cldnn_activation_func
activation functions
Definition: cldnn.h:373
activation(const primitive_id &id, const primitive_id &input, const primitive_id &additional_params_input, cldnn_activation_func activation_func, const padding &output_padding=padding())
Constructs activation with input per feature.
Definition: activation.hpp:68
activation additional params
Definition: cldnn.h:389
activation(const dto *dto)
Constructs a copy from basic C API cldnn_activation_desc.
Definition: activation.hpp:83
cldnn_activation_additional_params additional_params
activation additional params.
Definition: activation.hpp:95
const primitive_id id
Primitive&#39;s id.
Definition: primitive.hpp:143
cldnn_activation_func activation_func
activation function.
Definition: activation.hpp:92
activation(const primitive_id &id, const primitive_id &input, cldnn_activation_func activation_func, cldnn_activation_additional_params additional_params={ 0.f, 0.f }, const padding &output_padding=padding())
Constructs Relu primitive.
Definition: activation.hpp:48
std::string primitive_id
Unique id of a primitive within a topology.
Definition: primitive.hpp:42
fixed_size_vector_ref input
List of ids of input primitives.
Definition: primitive.hpp:146
base class for all primitives implementations.
Definition: primitive.hpp:190
padding output_padding
Requested output padding.
Definition: primitive.hpp:149
Activation using rectified linear unit or parameterized rectified linear unit.
Definition: activation.h:41