MCPcopy Create free account
hub / github.com/Samsung/ONE / TEST_F

Function TEST_F

compiler/circle-mpqsolver/src/pattern/PatternSolver.test.cpp:50–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48} // namespace
49
50TEST_F(CircleMPQSolverPatternSolverTest, verify_results)
51{
52 auto m = luci::make_module();
53 _g.init();
54 _g.transfer_to(m.get());
55
56 // export to _module_path
57 luci::CircleExporter exporter;
58 luci::CircleFileExpContract contract(m.get(), _module_path);
59 EXPECT_TRUE(exporter.invoke(&contract));
60
61 // Create quantizer parameters
62 mpqsolver::core::Quantizer::Context ctx;
63 {
64 ctx.output_model_dtype = "uint8";
65 ctx.granularity = "channel";
66 ctx.input_type = "uint8";
67 ctx.output_type = "uint8";
68 ctx.save_min_max = false;
69 ctx.TF_style_maxpool = false;
70 }
71
72 // create solver
73 mpqsolver::pattern::PatternSolver solver(
74 ctx, std::vector<QuantizationPattern>(1, QuantizationPattern::Q8SoftmaxWithQ16SubExp));
75
76 // run solver
77 auto const res = solver.run(_module_path);
78 EXPECT_TRUE(res.get() != nullptr);
79 ASSERT_EQ(1, res.get()->size());
80
81 auto const graph = res.get()->graph();
82 ASSERT_NE(nullptr, graph);
83
84 uint32_t exp_count = 0;
85 for (auto node : loco::postorder_traversal(loco::output_nodes(graph)))
86 {
87 auto const exp = dynamic_cast<luci::CircleExp *>(node);
88 if (exp != nullptr)
89 {
90 exp_count += 1;
91 auto const dtype = exp->dtype();
92 // pattern was applied
93 ASSERT_EQ(loco::DataType::S16, dtype);
94 }
95 }
96
97 // the model has a single exp node
98 ASSERT_EQ(1, exp_count);
99}
100
101TEST_F(CircleMPQSolverPatternSolverTest, empty_patterns_NEG)
102{

Callers

nothing calls this directly

Calls 11

make_moduleFunction · 0.85
postorder_traversalFunction · 0.85
output_nodesFunction · 0.85
initMethod · 0.45
transfer_toMethod · 0.45
getMethod · 0.45
invokeMethod · 0.45
runMethod · 0.45
sizeMethod · 0.45
graphMethod · 0.45
dtypeMethod · 0.45

Tested by

no test coverage detected