Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
93c89587
Commit
93c89587
authored
Dec 13, 2023
by
Paul
Browse files
Split onnx tests
parent
d2532d0e
Changes
490
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
443 additions
and
0 deletions
+443
-0
test/onnx/parse/shape_end_oob_test.cpp
test/onnx/parse/shape_end_oob_test.cpp
+22
-0
test/onnx/parse/shape_gather_test.cpp
test/onnx/parse/shape_gather_test.cpp
+21
-0
test/onnx/parse/shape_start_oob_test.cpp
test/onnx/parse/shape_start_oob_test.cpp
+22
-0
test/onnx/parse/shape_test.cpp
test/onnx/parse/shape_test.cpp
+18
-0
test/onnx/parse/shrink_hard_test.cpp
test/onnx/parse/shrink_hard_test.cpp
+37
-0
test/onnx/parse/shrink_int8_test.cpp
test/onnx/parse/shrink_int8_test.cpp
+40
-0
test/onnx/parse/sign_test.cpp
test/onnx/parse/sign_test.cpp
+16
-0
test/onnx/parse/sin_test.cpp
test/onnx/parse/sin_test.cpp
+16
-0
test/onnx/parse/sinh_dynamic_test.cpp
test/onnx/parse/sinh_dynamic_test.cpp
+23
-0
test/onnx/parse/sinh_test.cpp
test/onnx/parse/sinh_test.cpp
+17
-0
test/onnx/parse/size_float_test.cpp
test/onnx/parse/size_float_test.cpp
+17
-0
test/onnx/parse/size_half_test.cpp
test/onnx/parse/size_half_test.cpp
+16
-0
test/onnx/parse/size_int_test.cpp
test/onnx/parse/size_int_test.cpp
+16
-0
test/onnx/parse/slice_3arg_test.cpp
test/onnx/parse/slice_3arg_test.cpp
+21
-0
test/onnx/parse/slice_5arg_reverse_test.cpp
test/onnx/parse/slice_5arg_reverse_test.cpp
+26
-0
test/onnx/parse/slice_5arg_step_test.cpp
test/onnx/parse/slice_5arg_step_test.cpp
+29
-0
test/onnx/parse/slice_5arg_test.cpp
test/onnx/parse/slice_5arg_test.cpp
+24
-0
test/onnx/parse/slice_constant_test.cpp
test/onnx/parse/slice_constant_test.cpp
+18
-0
test/onnx/parse/slice_dyn_test.cpp
test/onnx/parse/slice_dyn_test.cpp
+25
-0
test/onnx/parse/slice_max_end_test.cpp
test/onnx/parse/slice_max_end_test.cpp
+19
-0
No files found.
test/onnx/parse/shape_end_oob_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
shape_end_oob_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
{
1
,
4
}},
{
4
,
4
},
{
2
,
4
},
{
2
,
4
}}};
auto
p0
=
mm
->
add_parameter
(
"x"
,
s
);
migraphx
::
shape
s_shape
{
migraphx
::
shape
::
int64_type
,
{
4
}};
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dimensions_of"
,
{{
"end"
,
4
}}),
p0
);
mm
->
add_return
({
ret
});
migraphx
::
onnx_options
options
;
options
.
map_dyn_input_dims
[
"x"
]
=
{{
1
,
4
,
{
1
,
4
}},
{
4
,
4
},
{
2
,
4
},
{
2
,
4
}};
auto
prog
=
migraphx
::
parse_onnx
(
"shape_end_oob_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/shape_gather_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
shape_gather_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
7
,
3
,
10
}});
migraphx
::
shape
const_shape
{
migraphx
::
shape
::
int32_type
,
{
1
}};
auto
l2
=
mm
->
add_literal
(
migraphx
::
literal
{
const_shape
,
{
1
}});
auto
l1
=
mm
->
add_literal
(
migraphx
::
shape
{
migraphx
::
shape
::
int64_type
,
{
3
}},
l0
->
get_shape
().
lens
());
int
axis
=
0
;
mm
->
add_instruction
(
migraphx
::
make_op
(
"gather"
,
{{
"axis"
,
axis
}}),
l1
,
l2
);
auto
prog
=
optimize_onnx
(
"shape_gather_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/shape_start_oob_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
shape_start_oob_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
{
1
,
4
}},
{
4
,
4
},
{
2
,
4
},
{
2
,
4
}}};
auto
p0
=
mm
->
add_parameter
(
"x"
,
s
);
migraphx
::
shape
s_shape
{
migraphx
::
shape
::
int64_type
,
{
4
}};
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"dimensions_of"
,
{{
"end"
,
4
}}),
p0
);
mm
->
add_return
({
ret
});
migraphx
::
onnx_options
options
;
options
.
map_dyn_input_dims
[
"x"
]
=
{{
1
,
4
,
{
1
,
4
}},
{
4
,
4
},
{
2
,
4
},
{
2
,
4
}};
auto
prog
=
migraphx
::
parse_onnx
(
"shape_start_oob_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/shape_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
shape_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}};
auto
l0
=
mm
->
add_parameter
(
"x"
,
s
);
migraphx
::
shape
s_shape
{
migraphx
::
shape
::
int64_type
,
{
4
}};
mm
->
add_literal
(
s_shape
,
l0
->
get_shape
().
lens
());
auto
prog
=
optimize_onnx
(
"shape_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/shrink_hard_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
shrink_hard_test
)
{
migraphx
::
program
p
;
float
bias
=
0.0
;
float
lambd
=
1.5
;
std
::
vector
<
size_t
>
lens
{
5
};
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
lens
});
auto
lit_bias
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
::
float_type
,
{
bias
}});
auto
lit_neg_lambd
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
::
float_type
,
{
-
lambd
}});
auto
lit_lambd
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
::
float_type
,
{
lambd
}});
auto
x_plus_bias
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"add"
),
{
x
,
lit_bias
});
auto
x_min_bias
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"sub"
),
{
x
,
lit_bias
});
auto
cond1
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"less"
),
{
x
,
lit_neg_lambd
});
auto
cond2_a
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"not"
),
{
cond1
});
auto
cond2_b
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"greater"
),
{
x
,
lit_lambd
});
auto
cond2
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"logical_and"
),
{
cond2_a
,
cond2_b
});
auto
mul1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"convert"
,
{{
"target_type"
,
migraphx
::
shape
::
float_type
}}),
cond1
);
auto
mul2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"convert"
,
{{
"target_type"
,
migraphx
::
shape
::
float_type
}}),
cond2
);
auto
first
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"mul"
),
{
mul1
,
x_plus_bias
});
auto
second
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"mul"
),
{
mul2
,
x_min_bias
});
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"add"
),
{
first
,
second
});
auto
prog
=
optimize_onnx
(
"shrink_hard_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/shrink_int8_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
shrink_int8_test
)
{
migraphx
::
program
p
;
float
bias
=
1.5
;
float
lambd
=
1.5
;
std
::
vector
<
size_t
>
lens
{
3
,
3
};
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
int8_type
,
lens
});
auto
lit_bias
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
::
float_type
,
{
bias
}});
auto
lit_neg_lambd
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
::
float_type
,
{
-
lambd
}});
auto
lit_lambd
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
::
float_type
,
{
lambd
}});
auto
x_plus_bias
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"add"
),
{
x
,
lit_bias
});
auto
x_min_bias
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"sub"
),
{
x
,
lit_bias
});
auto
cond1
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"less"
),
{
x
,
lit_neg_lambd
});
auto
cond2_a
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"not"
),
{
cond1
});
auto
cond2_b
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"greater"
),
{
x
,
lit_lambd
});
auto
cond2
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"logical_and"
),
{
cond2_a
,
cond2_b
});
auto
mul1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"convert"
,
{{
"target_type"
,
migraphx
::
shape
::
int8_type
}}),
cond1
);
auto
mul2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"convert"
,
{{
"target_type"
,
migraphx
::
shape
::
int8_type
}}),
cond2
);
auto
first
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"mul"
),
{
mul1
,
x_plus_bias
});
auto
second
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"mul"
),
{
mul2
,
x_min_bias
});
auto
ret
=
add_common_op
(
*
mm
,
migraphx
::
make_op
(
"add"
),
{
first
,
second
});
mm
->
add_instruction
(
migraphx
::
make_op
(
"convert"
,
{{
"target_type"
,
migraphx
::
shape
::
int8_type
}}),
ret
);
auto
prog
=
optimize_onnx
(
"shrink_int8_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/sign_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
sign_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
input
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
double_type
,
{
10
,
5
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"sign"
),
input
);
auto
prog
=
optimize_onnx
(
"sign_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/sin_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
sin_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
input
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
10
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"sin"
),
input
);
auto
prog
=
optimize_onnx
(
"sin_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/sinh_dynamic_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
sinh_dynamic_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
::
dynamic_dimension
dd
{
1
,
10
};
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
dyn_dims
;
dyn_dims
.
push_back
(
dd
);
auto
input
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
dyn_dims
});
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"sinh"
),
input
);
mm
->
add_return
({
ret
});
migraphx
::
onnx_options
options
;
options
.
default_dyn_dim_value
=
dd
;
auto
prog
=
parse_onnx
(
"sinh_dynamic_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/sinh_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
sinh_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
input
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
10
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"sinh"
),
input
);
auto
prog
=
optimize_onnx
(
"sinh_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/size_float_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
size_float_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
s
=
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
}};
mm
->
add_parameter
(
"x"
,
s
);
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
::
int64_type
,
{
s
.
elements
()}});
auto
prog
=
optimize_onnx
(
"size_float_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/size_half_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
size_half_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
s
=
migraphx
::
shape
{
migraphx
::
shape
::
half_type
,
{
3
,
1
}};
mm
->
add_parameter
(
"x"
,
s
);
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
::
int64_type
,
{
s
.
elements
()}});
auto
prog
=
optimize_onnx
(
"size_half_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/size_int_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
size_int_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
s
=
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{
8
,
2
,
3
}};
mm
->
add_parameter
(
"x"
,
s
);
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
::
int64_type
,
{
s
.
elements
()}});
auto
prog
=
optimize_onnx
(
"size_int_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/slice_3arg_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
slice_3arg_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
5
,
5
}});
mm
->
add_literal
({{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
0
,
0
}});
mm
->
add_literal
({{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
2
,
5
}});
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
,
1
}},
{
"starts"
,
{
0
,
0
}},
{
"ends"
,
{
2
,
5
}}}),
l0
);
mm
->
add_return
({
ret
});
auto
prog
=
migraphx
::
parse_onnx
(
"slice_3arg_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/slice_5arg_reverse_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
slice_5arg_reverse_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
5
,
5
}});
mm
->
add_literal
({{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
-
1
,
1
}});
mm
->
add_literal
({{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
-
1
,
-
2
}});
mm
->
add_literal
({{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
-
5
,
-
1
}});
mm
->
add_literal
({{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
-
1
,
-
3
}});
auto
slice_out
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
-
1
,
-
2
}},
{
"starts"
,
{
-
4
,
-
3
}},
{
"ends"
,
{
2147483647
,
-
1
}}}),
l0
);
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reverse"
,
{{
"axes"
,
{
-
1
}}}),
slice_out
);
mm
->
add_return
({
ret
});
auto
prog
=
migraphx
::
parse_onnx
(
"slice_5arg_reverse_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/slice_5arg_step_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
slice_5arg_step_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
5
,
5
}});
mm
->
add_literal
({{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
-
2
,
2
}});
mm
->
add_literal
({{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
-
1
,
-
2
}});
mm
->
add_literal
({{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
-
5
,
-
1
}});
mm
->
add_literal
({{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
-
1
,
-
3
}});
auto
slice_out
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
-
1
,
-
2
}},
{
"starts"
,
{
-
4
,
-
3
}},
{
"ends"
,
{
2147483647
,
-
1
}}}),
l0
);
auto
reverse_out
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reverse"
,
{{
"axes"
,
{
-
1
}}}),
slice_out
);
auto
step_out
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"step"
,
{{
"axes"
,
{
-
1
,
-
2
}},
{
"steps"
,
{
2
,
2
}}}),
reverse_out
);
mm
->
add_return
({
step_out
});
auto
prog
=
migraphx
::
parse_onnx
(
"slice_5arg_step_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/slice_5arg_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
slice_5arg_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
5
,
5
}});
mm
->
add_literal
({{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
1
,
1
}});
mm
->
add_literal
({{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
-
1
,
-
2
}});
mm
->
add_literal
({{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
-
1
,
-
1
}});
mm
->
add_literal
({{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
-
5
,
-
3
}});
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
-
1
,
-
2
}},
{
"starts"
,
{
-
5
,
-
3
}},
{
"ends"
,
{
-
1
,
-
1
}}}),
l0
);
mm
->
add_return
({
ret
});
auto
prog
=
migraphx
::
parse_onnx
(
"slice_5arg_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/slice_constant_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
slice_constant_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
2
}},
{
0
,
1
,
2
,
3
,
4
,
5
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
,
1
}},
{
"starts"
,
{
1
,
0
}},
{
"ends"
,
{
2
,
2
}}}),
l0
);
auto
prog
=
optimize_onnx
(
"slice_constant_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/slice_dyn_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
slice_dyn_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
3
,
3
},
{
1
,
3
},
{
2
,
2
}}});
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
1
}},
{
"ends"
,
{
2
}}}),
l0
);
mm
->
add_return
({
ret
});
migraphx
::
onnx_options
options
;
// Parser converts the dynamic input shape to static unless there is at least one non-fixed
// dynamic dimension. Slicing is not allowed along the non-fixed axis 1.
options
.
map_dyn_input_dims
[
"0"
]
=
{{
3
,
3
},
{
1
,
3
},
{
2
,
2
}};
auto
prog
=
migraphx
::
parse_onnx
(
"slice_dyn_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/slice_max_end_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
slice_max_end_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
10
,
20
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
,
1
}},
{
"starts"
,
{
1
,
2
}},
{
"ends"
,
{
3000000000
,
-
1
}}}),
l0
);
auto
prog
=
optimize_onnx
(
"slice_max_end_test.onnx"
);
EXPECT
(
p
==
prog
);
}
Prev
1
…
17
18
19
20
21
22
23
24
25
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment