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