clDNN
lrn.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/lrn.h"
20 #include "primitive.hpp"
21 
22 namespace cldnn
23 {
30 
42 struct lrn :public primitive_base<lrn, CLDNN_PRIMITIVE_DESC(lrn)>
43 {
44  CLDNN_DECLATE_PRIMITIVE(lrn)
45 
46 
47  lrn(
55  const primitive_id& id,
56  const primitive_id& input,
57  uint32_t size,
58  float k,
59  float alpha,
60  float beta,
61  cldnn_lrn_norm_region lrn_norm_region,
62  const padding& output_padding = padding()
63  )
65  , size(size)
66  , k(k)
67  , alpha(alpha)
68  , beta(beta)
69  , norm_region(lrn_norm_region)
70  {}
71 
73  lrn(const dto* dto)
75  , size(dto->size)
76  , k(dto->k)
77  , alpha(dto->alpha)
78  , beta(dto->beta)
80  {}
81 
83  uint32_t size;
85  float k;
87  float alpha;
89  float beta;
91  cldnn_lrn_norm_region norm_region;
92 
93 protected:
94  void update_dto(dto& dto) const override
95  {
96  dto.size = size;
97  dto.k = k;
98  dto.alpha = alpha;
99  dto.beta = beta;
101  }
102 };
106 }
uint32_t size
Size of normalization.
Definition: lrn.hpp:83
Local response normalization.
Definition: lrn.hpp:42
Local response normalization.
Definition: lrn.h:50
Represents data padding information.
Definition: layout.hpp:125
float k
Hyper parameter "k".
Definition: lrn.h:54
float beta
Hyper parameter "beta".
Definition: lrn.h:58
lrn(const primitive_id &id, const primitive_id &input, uint32_t size, float k, float alpha, float beta, cldnn_lrn_norm_region lrn_norm_region, const padding &output_padding=padding())
Constructs LRN primitive.
Definition: lrn.hpp:54
cldnn_lrn_norm_region norm_region
Normalize across or within channel.
Definition: lrn.h:60
float alpha
Hyper parameter "alpha".
Definition: lrn.h:56
float k
Hyper parameter "k".
Definition: lrn.hpp:85
float alpha
Hyper parameter "alpha".
Definition: lrn.hpp:87
float beta
Hyper parameter "beta".
Definition: lrn.hpp:89
cldnn_lrn_norm_region norm_region
Normalize across or within channel.
Definition: lrn.hpp:91
std::string primitive_id
Unique id of a primitive within a topology.
Definition: primitive.hpp:42
lrn(const dto *dto)
Constructs a copy from C API cldnn_normalization_desc.
Definition: lrn.hpp:73
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
uint32_t size
Size of normalization.
Definition: lrn.h:52
padding output_padding
Requested output padding.
Definition: primitive.hpp:149