| 17 | namespace custom { |
| 18 | |
| 19 | TEST(TestCustomOp, TestCustomOpInfoSetter) { |
| 20 | CustomOp test("TestOp", CUSTOM_OP_VERSION); |
| 21 | test.set_description("Test Op") |
| 22 | .add_input("lhs", "lhs of test op", {"float32", "int32"}, 2) |
| 23 | .add_inputs(2) |
| 24 | .add_input("rhs", "rhs of test op", {"float32", "int32"}, 2) |
| 25 | .add_outputs(1) |
| 26 | .add_output("out", "out of test op", {"float32", "int32"}, 2) |
| 27 | .add_outputs(3); |
| 28 | |
| 29 | ASSERT_TRUE(test.op_type() == "TestOp"); |
| 30 | ASSERT_TRUE(test.op_desc() == "Test Op"); |
| 31 | ASSERT_TRUE(test.input_num() == 4); |
| 32 | ASSERT_TRUE(test.output_num() == 5); |
| 33 | |
| 34 | #if OP_TEST_LOG |
| 35 | for (auto input : test.inputs_info()) { |
| 36 | std::cout << input.str() << std::endl; |
| 37 | } |
| 38 | for (auto output : test.outputs_info()) { |
| 39 | std::cout << output.str() << std::endl; |
| 40 | } |
| 41 | #endif |
| 42 | |
| 43 | test.add_param("param1", "param1 - float", 1.23f) |
| 44 | .add_param("param2", "param2 - float list", {2.34f, 3.45f}) |
| 45 | .add_param("param3", "param3 - string", "test-string") |
| 46 | .add_param("param4", {"test", "string", "list"}) |
| 47 | .add_param("param5", 1); |
| 48 | |
| 49 | #if OP_TEST_LOG |
| 50 | ParamInfo pinfo = test.param_info(); |
| 51 | for (auto kv : pinfo.meta()) { |
| 52 | std::cout << kv.str() << std::endl; |
| 53 | } |
| 54 | #endif |
| 55 | } |
| 56 | |
| 57 | void device_infer( |
| 58 | const std::vector<Device>& inputs, const Param& params, |
nothing calls this directly
no test coverage detected