op_test.cc 607 Bytes
Newer Older
tqchen committed
1 2
#include <dmlc/logging.h>
#include <gtest/gtest.h>
3
#include <nnvm/op.h>
tqchen committed
4 5
#include <utility>

6
NNVM_REGISTER_OP(add)
tqchen committed
7 8
.describe("add two data together")
.set_num_inputs(2)
Tianqi Chen committed
9
.set_attr("inplace_pair", std::make_pair(0, 0));
tqchen committed
10

11
NNVM_REGISTER_OP(add)
Tianqi Chen committed
12
.set_attr<std::string>("nick_name", "plus");
tqchen committed
13 14 15


TEST(Op, GetAttr) {
16
  using namespace nnvm;
tqchen committed
17 18 19 20 21
  auto add = Op::Get("add");
  auto nick = Op::GetAttr<std::string>("nick_name");

  CHECK_EQ(nick[add], "plus");
}
22 23 24 25 26 27

int main(int argc, char ** argv) {
  testing::InitGoogleTest(&argc, argv);
  testing::FLAGS_gtest_death_test_style = "threadsafe";
  return RUN_ALL_TESTS();
}