2 // Copyright (c) 2019 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 "reverse_sequence_inst.h"
19 #include "primitive_type_base.h"
20 #include "error_handler.h"
21 #include "json_object.h"
25 primitive_type_id reverse_sequence_type_id()
27 static primitive_type_base<reverse_sequence> instance;
31 layout reverse_sequence_inst::calc_output_layout(reverse_sequence_node const& node)
33 auto desc = node.get_primitive();
35 auto input_layout = node.input(0).get_output_layout();
36 auto input_format = input_layout.format;
38 return layout{input_layout.data_type, input_format, input_layout.size};
41 std::string reverse_sequence_inst::to_string(reverse_sequence_node const& node)
43 auto desc = node.get_primitive();
44 auto node_info = node.desc_to_json();
46 std::stringstream primitive_description;
48 json_composite reverse_sequence_info;
49 reverse_sequence_info.add("input id", node.input(0).id());
50 reverse_sequence_info.add("sequence lengths id", node.input(1).id());
51 reverse_sequence_info.add("sequence axis", desc->seq_axis);
52 reverse_sequence_info.add("batch axis", desc->batch_axis);
54 node_info->add("reverse_sequence info", reverse_sequence_info);
55 node_info->dump(primitive_description);
57 return primitive_description.str();
60 reverse_sequence_inst::typed_primitive_inst(network_impl& network, reverse_sequence_node const& node)
61 : parent(network, node)