Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / src / mvn.cpp
1 /*
2 // Copyright (c) 2018 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
17 #include "mvn_inst.h"
18 #include "primitive_type_base.h"
19 #include "json_object.h"
20
21 namespace cldnn
22 {
23 primitive_type_id mvn_type_id()
24 {
25     static primitive_type_base<mvn> instance;
26     return &instance;
27 }
28
29 layout mvn_inst::calc_output_layout(mvn_node const& node)
30 {
31     assert((bool)node.get_primitive()->output_data_type == false
32            && "Output data type forcing is not supported for mvn_node!");
33     return node.input().get_non_padded_output_layout();
34 }
35
36 std::string mvn_inst::to_string(mvn_node const& node)
37 {
38     auto node_info    = node.desc_to_json();
39     auto desc         = node.get_primitive();
40     auto epsilon      = desc->epsilon;
41     auto across_channels = desc->across_channels ? "true" : "false";
42     auto normalize_variance = desc->normalize_variance ? "true" : "false";
43     auto& input       = node.input();
44     
45     std::stringstream primitive_description;
46
47     json_composite mvn_info;
48     mvn_info.add("input id", input.id());
49     mvn_info.add("epsilon", epsilon);
50     mvn_info.add("across_channels region", across_channels);
51     mvn_info.add("normalize_variance region", normalize_variance);
52
53     node_info->add("mvn info", mvn_info);
54     node_info->dump(primitive_description);
55
56     return primitive_description.str();
57 }
58
59 mvn_inst::typed_primitive_inst(network_impl& network, mvn_node const& node)
60     :parent(network, node)
61 {
62
63 }
64 }