2 // Copyright (c) 2018 Intel Corporation
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include "batch_norm_grad_inst.h"
18 #include "primitive_type_base.h"
19 #include "error_handler.h"
20 #include "json_object.h"
24 primitive_type_id batch_norm_grad_type_id()
26 static primitive_type_base<batch_norm_grad> instance;
30 layout batch_norm_grad_inst::calc_output_layout(parent::typed_node const& node)
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();
38 std::string batch_norm_grad_inst::to_string(batch_norm_grad_node const& node)
40 auto desc = node.get_primitive();
41 auto node_info = node.desc_to_json();
42 auto& inv_var = node.inv_variance();
44 std::stringstream primitive_description;
46 json_composite batch_norm_grad_info;
48 batch_norm_grad_info.add("inv_variance_id", inv_var.id());
50 node_info->add("batch_norm_grad info", batch_norm_grad_info);
51 node_info->dump(primitive_description);
53 return primitive_description.str();
56 batch_norm_grad_inst::typed_primitive_inst(network_impl& network, batch_norm_grad_node const& node)
57 :parent(network, node)