test_activation_op.cc 1.4 KB
Newer Older
L
Luo Tao 已提交
1 2
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.

L
Luo Tao 已提交
3 4 5
   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
L
Luo Tao 已提交
6

L
Luo Tao 已提交
7
   http://www.apache.org/licenses/LICENSE-2.0
L
Luo Tao 已提交
8

L
Luo Tao 已提交
9 10 11 12 13
   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. */
L
Luo Tao 已提交
14 15 16

#include <gtest/gtest.h>
#include "paddle/fluid/framework/op_registry.h"
L
Luo Tao 已提交
17
#include "paddle/fluid/inference/tensorrt/convert/ut_helper.h"
L
Luo Tao 已提交
18 19 20 21 22

namespace paddle {
namespace inference {
namespace tensorrt {

L
Luo Tao 已提交
23
TEST(ReluOpConverter, main) {
L
Luo Tao 已提交
24
  framework::Scope scope;
L
Luo Tao 已提交
25
  std::unordered_set<std::string> parameters;
26
  TRTConvertValidation validator(10, parameters, scope, 1000);
L
Luo Tao 已提交
27 28 29 30 31 32 33 34 35 36 37 38 39
  validator.DeclInputVar("relu-X", nvinfer1::Dims2(10, 6));
  validator.DeclOutputVar("relu-Out", nvinfer1::Dims2(10, 6));

  // Prepare Op description
  framework::OpDesc desc;
  desc.SetType("relu");
  desc.SetInput("X", {"relu-X"});
  desc.SetOutput("Out", {"relu-Out"});

  LOG(INFO) << "set OP";
  validator.SetOp(*desc.Proto());
  LOG(INFO) << "execute";

40
  validator.Execute(1);
L
Luo Tao 已提交
41 42 43 44 45
}

}  // namespace tensorrt
}  // namespace inference
}  // namespace paddle
Y
Yan Chunwei 已提交
46

L
Luo Tao 已提交
47
USE_OP(relu);