fetch_op.h 1.7 KB
Newer Older
L
liuruilong 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

#pragma once

17
#include <string>
L
liuruilong 已提交
18
#include "framework/operator.h"
Z
zhaojiaying01 已提交
19
#include "operators/kernel/fetch_kernel.h"
L
liuruilong 已提交
20 21 22 23
#include "operators/op_param.h"

namespace paddle_mobile {
namespace operators {
24
using std::string;
L
liuruilong 已提交
25 26

template <typename DeviceType, typename T>
Z
zhaojiaying01 已提交
27 28 29
class FetchOp
    : public framework::OperatorWithKernel<DeviceType, FetchParam<DeviceType>,
                                           FetchKernel<DeviceType, T>> {
L
liuruilong 已提交
30
 public:
31
  FetchOp(const string &type, const VariableNameMap &inputs,
L
liuruilong 已提交
32 33
          const VariableNameMap &outputs, const framework::AttributeMap attrs,
          std::shared_ptr<framework::Scope> scope)
Z
zhaojiaying01 已提交
34 35 36
      : framework::OperatorWithKernel<DeviceType, FetchParam<DeviceType>,
                                      FetchKernel<DeviceType, T>>(
            type, inputs, outputs, attrs, scope) {}
L
liuruilong 已提交
37

Z
zhaojiaying01 已提交
38
  void InferShape() const override;
L
liuruilong 已提交
39

Z
zhaojiaying01 已提交
40
  void RunImpl() override;
L
liuruilong 已提交
41 42 43 44

 protected:
};

45 46 47
}  // namespace operators
}  // namespace paddle_mobile

L
for  
liuruilong 已提交
48 49 50 51
#ifdef PADDLE_MOBILE_CPU
USE_OP_CPU(fetch);
#endif
#ifdef PADDLE_MOBILE_MALI_GPU
E
eclipsess 已提交
52
USE_OP_MALI_GPU(fetch);
L
for  
liuruilong 已提交
53 54
#endif
#ifdef PADDLE_MOBILE_FPGA
Z
zhangyang 已提交
55
USE_OP_FPGA(fetch);
L
for  
liuruilong 已提交
56
#endif