Minor update to graph_test
Update graph_test to demonstrate that CompileToBinary does not require input data. Signed-off-by: Kainan Cha <kainan.zha@verisilicon.com>
This commit is contained in:
parent
301d88a5a6
commit
52401b52a5
|
|
@ -49,12 +49,6 @@ TEST(graph, gen_binary_graph_with_simple_add) {
|
|||
auto input_t1 = graph->CreateTensor(input_spec);
|
||||
auto output_t = graph->CreateTensor(output_spec);
|
||||
|
||||
float in = 1.0f;
|
||||
float expected_out = 2.0f;
|
||||
|
||||
EXPECT_TRUE(input_t0->CopyDataToTensor(&in, sizeof(in)));
|
||||
EXPECT_TRUE(input_t1->CopyDataToTensor(&in, sizeof(in)));
|
||||
|
||||
auto add = graph->CreateOperation<tim::vx::ops::Add>();
|
||||
(*add).BindInputs({input_t0, input_t1}).BindOutputs({output_t});
|
||||
|
||||
|
|
@ -63,9 +57,15 @@ TEST(graph, gen_binary_graph_with_simple_add) {
|
|||
EXPECT_NE(bin_size, -1);
|
||||
std::vector<char> nbg_buf(bin_size);
|
||||
|
||||
// generate binary graph does't require input data
|
||||
EXPECT_TRUE(graph->CompileToBinary(nbg_buf.data(), &bin_size));
|
||||
|
||||
// binary graph compilation doesn't impact current graph's execution
|
||||
float in = 1.0f;
|
||||
float expected_out = 2.0f;
|
||||
EXPECT_TRUE(input_t0->CopyDataToTensor(&in, sizeof(in)));
|
||||
EXPECT_TRUE(input_t1->CopyDataToTensor(&in, sizeof(in)));
|
||||
|
||||
EXPECT_TRUE(graph->Run());
|
||||
float output = 0.0f;
|
||||
EXPECT_TRUE(output_t->CopyDataFromTensor(&output));
|
||||
|
|
|
|||
Loading…
Reference in New Issue