1 /*******************************************************************************
2 * Copyright 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.
15 *******************************************************************************/
17 #ifndef CPU_REF_ROI_POOLING_FWD_HPP
18 #define CPU_REF_ROI_POOLING_FWD_HPP
22 #include "c_types_map.hpp"
23 #include "cpu_roi_pooling_pd.hpp"
24 #include "cpu_engine.hpp"
25 #include "type_helpers.hpp"
32 template <impl::data_type_t data_type>
33 struct ref_roi_pooling_fwd_t: public cpu_primitive_t {
34 struct pd_t: public cpu_roi_pooling_fwd_pd_t {
35 pd_t(engine_t *engine, const roi_pooling_desc_t *adesc,
36 const primitive_attr_t *attr,
37 const roi_pooling_fwd_pd_t *hint_fwd_pd)
38 : cpu_roi_pooling_fwd_pd_t(engine, adesc, attr, hint_fwd_pd) {}
40 DECLARE_COMMON_PD_T("ref:any", ref_roi_pooling_fwd_t);
42 virtual status_t init() override {
43 using namespace prop_kind;
44 assert(engine()->kind() == engine_kind::cpu);
46 && utils::one_of(desc()->prop_kind, forward_inference)
47 && utils::everyone_is(data_type, src_pd()->desc()->data_type,
48 dst_pd()->desc()->data_type);
49 if (!ok) return status::unimplemented;
51 return status::success;
55 ref_roi_pooling_fwd_t(const pd_t *apd, const input_vector &inputs,
56 const output_vector &outputs)
57 : cpu_primitive_t(apd, inputs, outputs) { }
59 typedef typename prec_traits<data_type>::type data_t;
61 ~ref_roi_pooling_fwd_t() { }
63 virtual void execute(event_t *e) const {
64 execute_forward_generic();
65 e->set_state(event_t::ready);
69 void execute_forward_generic() const;
70 const pd_t *pd() const { return (const pd_t *)primitive_t::pd(); }
79 // vim: et ts=4 sw=4 cindent cino^=l0,\:0,N-s