2 // Copyright (c) 2016 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 ///////////////////////////////////////////////////////////////////////////////////////////////////
19 #include "api/CPP/reorder.hpp"
20 #include "primitive_inst.h"
26 struct typed_program_node<reorder> : public typed_program_node_base<reorder>
28 using parent = typed_program_node_base<reorder>;
33 decltype(auto) input() const { return get_dependency(0); }
34 decltype(auto) mean() const { return get_dependency(1); }
36 bool has_mean() const { return !typed_desc()->mean.empty(); }
38 auto requires_reinterpret() const { return req_reinterpr; }
39 void requires_reinterpret(bool val) { req_reinterpr = (optimized && val); }
41 void set_input_offset(tensor const& io) { input_offset = io; }
42 tensor get_input_offset() const { return input_offset; }
45 bool req_reinterpr = false;
46 tensor input_offset = tensor{ 0 }; //used by reorder to winograd domain
49 using reorder_node = typed_program_node<reorder>;
52 class typed_primitive_inst<reorder> : public typed_primitive_inst_base<reorder>
54 using parent = typed_primitive_inst_base<reorder>;
57 static layout calc_output_layout(reorder_node const& node);
58 static std::string to_string(reorder_node const& node);
61 typed_primitive_inst(network_impl& network, reorder_node const& node);
63 decltype(auto) mean_memory() const { return dep_memory(1); }
65 bool has_mean() const { return !argument.mean.empty(); }
68 void on_execute() override;
72 using reorder_inst = typed_primitive_inst<reorder>;