|
|
@@ -30,24 +30,15 @@ class TestModelDeploySchedule : public testing::Test { |
|
|
|
|
|
|
|
TEST_F(TestModelDeploySchedule, test_data_slice) {
|
|
|
|
DEF_GRAPH(g1) {
|
|
|
|
auto data = std::make_shared<OpDesc>("data1", DATA);
|
|
|
|
auto var = std::make_shared<OpDesc>("var1", VARIABLE);
|
|
|
|
auto conv = std::make_shared<OpDesc>("conv1", CONV2D);
|
|
|
|
|
|
|
|
// data output 0
|
|
|
|
auto data_output_desc = data->MutableOutputDesc(0);
|
|
|
|
std::vector<std::vector<int64_t>> cut_attr = {{0, 0, 0, 0}};
|
|
|
|
ge::AttrUtils::SetListListInt(data_output_desc, "cut_info", cut_attr);
|
|
|
|
// conv input 0
|
|
|
|
auto conv_input_desc = conv->MutableInputDesc(0);
|
|
|
|
ge::AttrUtils::SetListListInt(conv_input_desc, "cut_info", {{1,0,0,0}, {0,0,0,0}});
|
|
|
|
// conv input 1
|
|
|
|
auto input_desc = conv->MutableInputDesc(1);
|
|
|
|
ge::AttrUtils::SetListListInt(input_desc, "cut_info", {{0, 0, 0, 0}, {0, 0, 1, 0}});
|
|
|
|
CHAIN(NODE(data)->NODE(conv));
|
|
|
|
CHAIN(NODE(var)->NODE(conv));
|
|
|
|
// CHAIN(NODE("data1", DATA)->NODE("conv1", CONV2D));
|
|
|
|
// CHAIN(NODE("var1", VARIABLE)->NODE("conv1"));
|
|
|
|
CHAIN(NODE("data1", DATA)->NODE(conv));
|
|
|
|
CHAIN(NODE("var1", VARIABLE)->NODE(conv));
|
|
|
|
};
|
|
|
|
|
|
|
|
map<AscendString, AscendString> options;
|
|
|
@@ -58,7 +49,29 @@ TEST_F(TestModelDeploySchedule, test_data_slice) { |
|
|
|
auto ret = session.BuildGraph(1, inputs);
|
|
|
|
|
|
|
|
EXPECT_EQ(ret, SUCCESS);
|
|
|
|
|
|
|
|
DEF_GRAPH(g1_1) {
|
|
|
|
auto conv = std::make_shared<OpDesc>("conv1", CONV2D);
|
|
|
|
// conv input 0
|
|
|
|
auto conv_input_desc = conv->MutableInputDesc(0);
|
|
|
|
ge::AttrUtils::SetListListInt(conv_input_desc, "cut_info", {{1, 0, 0, 0}, {0, 0, 0, 0}});
|
|
|
|
auto dims = conv_input_desc->GetShape().GetDims();
|
|
|
|
dims[0] /= 2;
|
|
|
|
conv_input_desc->SetShape(GeShape(dims));
|
|
|
|
// conv input 1
|
|
|
|
auto input_desc = conv->MutableInputDesc(1);
|
|
|
|
ge::AttrUtils::SetListListInt(input_desc, "cut_info", {{0, 0, 0, 0}, {0, 0, 1, 0}});
|
|
|
|
|
|
|
|
auto cov2 = OP_CFG(CONV2D).input(0, TensorDesc().attr("cut_info", {{1, 0, 0, 0}, {0, 0, 0, 0}});
|
|
|
|
auto slice =OP_CFG(SLICE).Attr("ddd ", 1).TensorDescShape(dims);
|
|
|
|
CHAIN(NODE("data1", DATA)->EDGE(0, 0)->NODE("any_slice", slice)->EDGE(0, 0)->NODE(conv));
|
|
|
|
CHAIN(NODE("any_var", VARIABLE)->EDGE(0, 0)->NODE("any_slice"));
|
|
|
|
CHAIN(NODE("var1", VARIABLE)->EDGE(0, 1)->NODE(conv));
|
|
|
|
};
|
|
|
|
|
|
|
|
CHECK_GRAPH(PreRunAfterBuild) {
|
|
|
|
|
|
|
|
ASSERT_GRAPH_CMP(graph, g1_1);
|
|
|
|
ASSERT_EQ(graph->GetName(), "g1_1");
|
|
|
|
ASSERT_EQ(graph->GetAllNodesSize(), 4);
|
|
|
|
};
|
|
|
|