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
579 additions
and
0 deletions
+579
-0
test/onnx/parse/reducesum_empty_axes_test.cpp
test/onnx/parse/reducesum_empty_axes_test.cpp
+20
-0
test/onnx/parse/reducesum_keepdims_test.cpp
test/onnx/parse/reducesum_keepdims_test.cpp
+16
-0
test/onnx/parse/reducesum_multiaxis_test.cpp
test/onnx/parse/reducesum_multiaxis_test.cpp
+17
-0
test/onnx/parse/reducesum_noop_test.cpp
test/onnx/parse/reducesum_noop_test.cpp
+17
-0
test/onnx/parse/reducesum_square_test.cpp
test/onnx/parse/reducesum_square_test.cpp
+18
-0
test/onnx/parse/reducesum_test.cpp
test/onnx/parse/reducesum_test.cpp
+17
-0
test/onnx/parse/reshape_non_standard_test.cpp
test/onnx/parse/reshape_non_standard_test.cpp
+21
-0
test/onnx/parse/reshape_test.cpp
test/onnx/parse/reshape_test.cpp
+22
-0
test/onnx/parse/reshape_variable_input_dyn_test.cpp
test/onnx/parse/reshape_variable_input_dyn_test.cpp
+23
-0
test/onnx/parse/reshape_variable_input_test.cpp
test/onnx/parse/reshape_variable_input_test.cpp
+19
-0
test/onnx/parse/resize_downsample_c_test.cpp
test/onnx/parse/resize_downsample_c_test.cpp
+32
-0
test/onnx/parse/resize_downsample_f_test.cpp
test/onnx/parse/resize_downsample_f_test.cpp
+31
-0
test/onnx/parse/resize_downsample_linear_test.cpp
test/onnx/parse/resize_downsample_linear_test.cpp
+73
-0
test/onnx/parse/resize_nonstd_input_test.cpp
test/onnx/parse/resize_nonstd_input_test.cpp
+34
-0
test/onnx/parse/resize_outsize_test.cpp
test/onnx/parse/resize_outsize_test.cpp
+32
-0
test/onnx/parse/resize_upsample_linear_ac_test.cpp
test/onnx/parse/resize_upsample_linear_ac_test.cpp
+13
-0
test/onnx/parse/resize_upsample_linear_test.cpp
test/onnx/parse/resize_upsample_linear_test.cpp
+100
-0
test/onnx/parse/resize_upsample_pc_test.cpp
test/onnx/parse/resize_upsample_pc_test.cpp
+32
-0
test/onnx/parse/resize_upsample_pf_test.cpp
test/onnx/parse/resize_upsample_pf_test.cpp
+32
-0
test/onnx/parse/reversesequence_batch_axis_err_test.cpp
test/onnx/parse/reversesequence_batch_axis_err_test.cpp
+10
-0
No files found.
test/onnx/parse/reducesum_empty_axes_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
reducesum_empty_axes_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
::
int64_type
});
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}});
auto
l1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reduce_sum"
,
{{
"axes"
,
{
0
,
1
,
2
,
3
}}}),
x
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"squeeze"
,
{{
"axes"
,
{
0
,
1
,
2
,
3
}}}),
l1
);
mm
->
add_return
({
r
});
auto
prog
=
migraphx
::
parse_onnx
(
"reducesum_empty_axes_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/reducesum_keepdims_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
reducesum_keepdims_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"reduce_sum"
,
{{
"axes"
,
{
2
,
3
}}}),
l0
);
auto
prog
=
optimize_onnx
(
"reducesum_keepdims_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/reducesum_multiaxis_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
reducesum_multiaxis_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}});
auto
l1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reduce_sum"
,
{{
"axes"
,
{
2
,
3
}}}),
l0
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"squeeze"
,
{{
"axes"
,
{
2
,
3
}}}),
l1
);
auto
prog
=
optimize_onnx
(
"reducesum_multiaxis_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/reducesum_noop_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
reducesum_noop_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
::
int64_type
});
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}});
mm
->
add_return
({
x
});
auto
prog
=
migraphx
::
parse_onnx
(
"reducesum_noop_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/reducesum_square_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
reducesum_square_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}});
auto
squ_l0
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
l0
,
l0
);
auto
sum_l0
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reduce_sum"
,
{{
"axes"
,
{
-
2
}}}),
squ_l0
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"squeeze"
,
{{
"axes"
,
{
-
2
}}}),
sum_l0
);
auto
prog
=
optimize_onnx
(
"reducesum_square_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/reducesum_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
reducesum_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}});
auto
l1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reduce_sum"
,
{{
"axes"
,
{
2
}}}),
l0
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"squeeze"
,
{{
"axes"
,
{
2
}}}),
l1
);
auto
prog
=
optimize_onnx
(
"reducesum_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/reshape_non_standard_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
#include <migraphx/op/reshape.hpp>
TEST_CASE
(
reshape_non_standard_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
op
::
reshape
op
;
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
tran_x
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
0
,
2
,
1
}}}),
x
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"reshape"
,
{{
"dims"
,
{
4
,
3
,
2
}}}),
tran_x
);
auto
prog
=
optimize_onnx
(
"reshape_non_standard_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/reshape_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
#include <migraphx/op/reshape.hpp>
TEST_CASE
(
reshape_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
op
::
reshape
op
;
std
::
vector
<
int64_t
>
reshape_dims
{
3
,
8
};
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
int64_type
,
{
2
}},
reshape_dims
});
auto
l0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
2
,
3
}});
op
.
dims
=
reshape_dims
;
mm
->
add_instruction
(
op
,
l0
);
mm
->
add_instruction
(
op
,
l0
);
auto
prog
=
optimize_onnx
(
"reshape_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/reshape_variable_input_dyn_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
reshape_variable_input_dyn_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
p0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
},
{
2
,
2
},
{
3
,
3
}}});
auto
p1
=
mm
->
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
int64_type
,
{
2
}});
auto
alloc
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"allocate"
,
{{
"buf_type"
,
migraphx
::
shape
::
float_type
}}),
p1
);
auto
reshape
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reshape"
),
p0
,
alloc
);
mm
->
add_return
({
reshape
});
migraphx
::
onnx_options
options
;
options
.
default_dyn_dim_value
=
{
1
,
4
};
auto
prog
=
parse_onnx
(
"reshape_variable_input_dyn_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/reshape_variable_input_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
reshape_variable_input_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
p0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
2
,
3
}});
auto
p1
=
mm
->
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
int64_type
,
{
2
}});
auto
alloc
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"allocate"
,
{{
"buf_type"
,
migraphx
::
shape
::
float_type
}}),
p1
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"reshape"
),
p0
,
alloc
);
auto
prog
=
optimize_onnx
(
"reshape_variable_input_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/resize_downsample_c_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
resize_downsample_c_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
std
::
vector
<
float
>
ds
=
{
1.0
f
,
1.0
f
,
0.6
f
,
0.6
f
};
migraphx
::
shape
ss
{
migraphx
::
shape
::
float_type
,
{
4
}};
mm
->
add_literal
(
migraphx
::
literal
{
ss
,
ds
});
migraphx
::
shape
sx
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
2
,
4
}};
auto
inx
=
mm
->
add_parameter
(
"X"
,
sx
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"undefined"
));
migraphx
::
shape
si
{
migraphx
::
shape
::
int32_type
,
{
1
,
1
,
1
,
2
}};
std
::
vector
<
int
>
ind
=
{
0
,
2
};
auto
li
=
mm
->
add_literal
(
migraphx
::
literal
(
si
,
ind
));
auto
lrsp
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reshape"
,
{{
"dims"
,
{
8
}}}),
inx
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"gather"
,
{{
"axis"
,
0
}}),
lrsp
,
li
);
mm
->
add_return
({
r
});
auto
prog
=
migraphx
::
parse_onnx
(
"resize_downsample_c_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/resize_downsample_f_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
resize_downsample_f_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
std
::
vector
<
float
>
ds
=
{
1.0
f
,
1.0
f
,
0.6
f
,
0.6
f
};
migraphx
::
shape
ss
{
migraphx
::
shape
::
float_type
,
{
4
}};
mm
->
add_literal
(
migraphx
::
literal
{
ss
,
ds
});
migraphx
::
shape
sx
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
2
,
4
}};
auto
inx
=
mm
->
add_parameter
(
"X"
,
sx
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"undefined"
));
migraphx
::
shape
si
{
migraphx
::
shape
::
int32_type
,
{
1
,
1
,
1
,
2
}};
std
::
vector
<
int
>
ind
=
{
0
,
3
};
auto
li
=
mm
->
add_literal
(
migraphx
::
literal
(
si
,
ind
));
auto
lrsp
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reshape"
,
{{
"dims"
,
{
8
}}}),
inx
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"gather"
,
{{
"axis"
,
0
}}),
lrsp
,
li
);
mm
->
add_return
({
r
});
auto
prog
=
migraphx
::
parse_onnx
(
"resize_downsample_f_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/resize_downsample_linear_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
resize_downsample_linear_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
ss
{
migraphx
::
shape
::
float_type
,
{
4
}};
std
::
vector
<
float
>
ds
=
{
1
,
1
,
0.6
,
0.5
};
mm
->
add_literal
(
migraphx
::
literal
(
ss
,
ds
));
migraphx
::
shape
sx
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
2
,
4
}};
auto
x
=
mm
->
add_parameter
(
"X"
,
sx
);
migraphx
::
shape
s_ind
{
migraphx
::
shape
::
int32_type
,
{
16
,
1
,
1
,
2
}};
std
::
vector
<
int
>
d_ind
=
{
0
,
2
,
0
,
2
,
0
,
2
,
0
,
2
,
4
,
6
,
4
,
6
,
4
,
6
,
4
,
6
,
1
,
3
,
1
,
3
,
1
,
3
,
1
,
3
,
5
,
7
,
5
,
7
,
5
,
7
,
5
,
7
};
auto
l_ind
=
mm
->
add_literal
(
migraphx
::
literal
(
s_ind
,
d_ind
));
migraphx
::
shape
s8
{
migraphx
::
shape
::
float_type
,
{
8
,
1
,
1
,
2
}};
std
::
vector
<
float
>
d8
(
16
,
0.5
f
);
auto
l8
=
mm
->
add_literal
(
migraphx
::
literal
(
s8
,
d8
));
migraphx
::
shape
s4
{
migraphx
::
shape
::
float_type
,
{
4
,
1
,
1
,
2
}};
std
::
vector
<
float
>
d4
(
8
,
1.0
f
/
3.0
f
);
auto
l4
=
mm
->
add_literal
(
migraphx
::
literal
(
s4
,
d4
));
migraphx
::
shape
s2
{
migraphx
::
shape
::
float_type
,
{
2
,
1
,
1
,
2
}};
std
::
vector
<
float
>
d2
(
4
,
0
);
auto
l2
=
mm
->
add_literal
(
migraphx
::
literal
(
s2
,
d2
));
migraphx
::
shape
s1
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
1
,
2
}};
std
::
vector
<
float
>
d1
(
2
,
0.0
f
);
auto
l1
=
mm
->
add_literal
(
migraphx
::
literal
(
s1
,
d1
));
mm
->
add_instruction
(
migraphx
::
make_op
(
"undefined"
));
auto
rsp
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reshape"
,
{{
"dims"
,
{
8
}}}),
x
);
auto
data
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"gather"
,
{{
"axis"
,
0
}}),
rsp
,
l_ind
);
auto
slc80
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
0
}},
{
"ends"
,
{
8
}}}),
data
);
auto
slc81
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
8
}},
{
"ends"
,
{
16
}}}),
data
);
auto
diff8
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"sub"
),
slc81
,
slc80
);
auto
mul8
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
diff8
,
l8
);
auto
add8
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
mul8
,
slc80
);
auto
slc40
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
0
}},
{
"ends"
,
{
4
}}}),
add8
);
auto
slc41
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
4
}},
{
"ends"
,
{
8
}}}),
add8
);
auto
diff4
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"sub"
),
slc41
,
slc40
);
auto
mul4
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
diff4
,
l4
);
auto
add4
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
mul4
,
slc40
);
auto
slc20
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
0
}},
{
"ends"
,
{
2
}}}),
add4
);
auto
slc21
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
2
}},
{
"ends"
,
{
4
}}}),
add4
);
auto
diff2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"sub"
),
slc21
,
slc20
);
auto
mul2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
diff2
,
l2
);
auto
add2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
mul2
,
slc20
);
auto
slc10
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
0
}},
{
"ends"
,
{
1
}}}),
add2
);
auto
slc11
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
1
}},
{
"ends"
,
{
2
}}}),
add2
);
auto
diff1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"sub"
),
slc11
,
slc10
);
auto
mul1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
diff1
,
l1
);
auto
add1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
mul1
,
slc10
);
mm
->
add_return
({
add1
});
auto
prog
=
migraphx
::
parse_onnx
(
"resize_downsample_linear_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/resize_nonstd_input_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
resize_nonstd_input_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
std
::
vector
<
float
>
ds
=
{
1.0
f
,
1.0
f
,
0.6
f
,
0.6
f
};
migraphx
::
shape
ss
{
migraphx
::
shape
::
float_type
,
{
4
}};
mm
->
add_literal
(
migraphx
::
literal
{
ss
,
ds
});
migraphx
::
shape
sx
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
4
,
2
}};
auto
inx
=
mm
->
add_parameter
(
"X"
,
sx
);
migraphx
::
shape
si
{
migraphx
::
shape
::
int32_type
,
{
1
,
1
,
1
,
2
}};
std
::
vector
<
int
>
ind
=
{
0
,
4
};
auto
li
=
mm
->
add_literal
(
migraphx
::
literal
(
si
,
ind
));
auto
tx
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
0
,
1
,
3
,
2
}}}),
inx
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"undefined"
));
auto
lrsp
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reshape"
,
{{
"dims"
,
{
8
}}}),
tx
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"gather"
,
{{
"axis"
,
0
}}),
lrsp
,
li
);
mm
->
add_return
({
r
});
auto
prog
=
migraphx
::
parse_onnx
(
"resize_nonstd_input_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/resize_outsize_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
resize_outsize_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
std
::
vector
<
int64_t
>
out_len
=
{
1
,
1
,
4
,
6
};
migraphx
::
shape
so
{
migraphx
::
shape
::
int64_type
,
{
4
}};
mm
->
add_literal
(
migraphx
::
literal
(
so
,
out_len
));
migraphx
::
shape
sx
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
2
,
2
}};
auto
inx
=
mm
->
add_parameter
(
"X"
,
sx
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"undefined"
));
migraphx
::
shape
si
{
migraphx
::
shape
::
int32_type
,
{
1
,
1
,
4
,
6
}};
std
::
vector
<
int
>
ind
=
{
0
,
0
,
1
,
1
,
1
,
1
,
2
,
2
,
3
,
3
,
3
,
3
,
2
,
2
,
3
,
3
,
3
,
3
,
2
,
2
,
3
,
3
,
3
,
3
};
auto
li
=
mm
->
add_literal
(
migraphx
::
literal
(
si
,
ind
));
auto
lrsp
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reshape"
,
{{
"dims"
,
{
4
}}}),
inx
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"gather"
,
{{
"axis"
,
0
}}),
lrsp
,
li
);
mm
->
add_return
({
r
});
auto
prog
=
migraphx
::
parse_onnx
(
"resize_outsize_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/resize_upsample_linear_ac_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
#include <onnx_test_utils.hpp>
TEST_CASE
(
resize_upsample_linear_ac_test
)
{
auto
p
=
create_upsample_linear_prog
();
auto
prog
=
migraphx
::
parse_onnx
(
"resize_upsample_linear_ac_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/resize_upsample_linear_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
resize_upsample_linear_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
ss
{
migraphx
::
shape
::
float_type
,
{
4
}};
std
::
vector
<
float
>
ds
=
{
1
,
1
,
2
,
2
};
mm
->
add_literal
(
migraphx
::
literal
(
ss
,
ds
));
migraphx
::
shape
sx
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
2
,
2
}};
auto
x
=
mm
->
add_parameter
(
"X"
,
sx
);
migraphx
::
shape
s_ind
{
migraphx
::
shape
::
int32_type
,
{
16
,
1
,
4
,
4
}};
std
::
vector
<
int
>
d_ind
=
{
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
2
,
2
,
2
,
3
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
2
,
2
,
2
,
3
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
2
,
2
,
2
,
3
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
2
,
2
,
2
,
3
,
0
,
0
,
0
,
1
,
2
,
2
,
2
,
3
,
2
,
2
,
2
,
3
,
2
,
2
,
2
,
3
,
0
,
0
,
0
,
1
,
2
,
2
,
2
,
3
,
2
,
2
,
2
,
3
,
2
,
2
,
2
,
3
,
0
,
0
,
0
,
1
,
2
,
2
,
2
,
3
,
2
,
2
,
2
,
3
,
2
,
2
,
2
,
3
,
0
,
0
,
0
,
1
,
2
,
2
,
2
,
3
,
2
,
2
,
2
,
3
,
2
,
2
,
2
,
3
,
0
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
2
,
3
,
3
,
3
,
0
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,
0
,
1
,
1
,
1
,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
,
0
,
0
,
1.0
f
/
3
,
1.0
f
/
3
,
1.0
f
/
3
,
1.0
f
/
3
,
2.0
f
/
3
,
2.0
f
/
3
,
2.0
f
/
3
,
2.0
f
/
3
,
0
,
0
,
0
,
0
};
auto
l4
=
mm
->
add_literal
(
migraphx
::
literal
(
s4
,
d4
));
migraphx
::
shape
s2
{
migraphx
::
shape
::
float_type
,
{
2
,
1
,
4
,
4
}};
std
::
vector
<
float
>
d2
(
32
,
0
);
auto
l2
=
mm
->
add_literal
(
migraphx
::
literal
(
s2
,
d2
));
migraphx
::
shape
s1
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
4
,
4
}};
std
::
vector
<
float
>
d1
(
16
,
0.0
f
);
auto
l1
=
mm
->
add_literal
(
migraphx
::
literal
(
s1
,
d1
));
mm
->
add_instruction
(
migraphx
::
make_op
(
"undefined"
));
auto
rsp
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reshape"
,
{{
"dims"
,
{
4
}}}),
x
);
auto
data
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"gather"
,
{{
"axis"
,
0
}}),
rsp
,
l_ind
);
auto
slc80
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
0
}},
{
"ends"
,
{
8
}}}),
data
);
auto
slc81
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
8
}},
{
"ends"
,
{
16
}}}),
data
);
auto
diff8
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"sub"
),
slc81
,
slc80
);
auto
mul8
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
diff8
,
l8
);
auto
add8
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
mul8
,
slc80
);
auto
slc40
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
0
}},
{
"ends"
,
{
4
}}}),
add8
);
auto
slc41
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
4
}},
{
"ends"
,
{
8
}}}),
add8
);
auto
diff4
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"sub"
),
slc41
,
slc40
);
auto
mul4
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
diff4
,
l4
);
auto
add4
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
mul4
,
slc40
);
auto
slc20
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
0
}},
{
"ends"
,
{
2
}}}),
add4
);
auto
slc21
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
2
}},
{
"ends"
,
{
4
}}}),
add4
);
auto
diff2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"sub"
),
slc21
,
slc20
);
auto
mul2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
diff2
,
l2
);
auto
add2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
mul2
,
slc20
);
auto
slc10
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
0
}},
{
"ends"
,
{
1
}}}),
add2
);
auto
slc11
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
1
}},
{
"ends"
,
{
2
}}}),
add2
);
auto
diff1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"sub"
),
slc11
,
slc10
);
auto
mul1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
diff1
,
l1
);
auto
add1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
mul1
,
slc10
);
mm
->
add_return
({
add1
});
auto
prog
=
migraphx
::
parse_onnx
(
"resize_upsample_linear_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/resize_upsample_pc_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
resize_upsample_pc_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
std
::
vector
<
float
>
ds
=
{
1.0
f
,
1.0
f
,
2.0
f
,
1.5
f
};
migraphx
::
shape
ss
{
migraphx
::
shape
::
float_type
,
{
4
}};
mm
->
add_literal
(
migraphx
::
literal
{
ss
,
ds
});
migraphx
::
shape
sx
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
2
,
4
}};
auto
inx
=
mm
->
add_parameter
(
"X"
,
sx
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"undefined"
));
migraphx
::
shape
si
{
migraphx
::
shape
::
int32_type
,
{
1
,
1
,
4
,
6
}};
std
::
vector
<
int
>
ind
=
{
0
,
1
,
1
,
2
,
3
,
3
,
0
,
1
,
1
,
2
,
3
,
3
,
4
,
5
,
5
,
6
,
7
,
7
,
4
,
5
,
5
,
6
,
7
,
7
};
auto
li
=
mm
->
add_literal
(
migraphx
::
literal
(
si
,
ind
));
auto
lrsp
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reshape"
,
{{
"dims"
,
{
8
}}}),
inx
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"gather"
,
{{
"axis"
,
0
}}),
lrsp
,
li
);
mm
->
add_return
({
r
});
auto
prog
=
migraphx
::
parse_onnx
(
"resize_upsample_pc_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/resize_upsample_pf_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
resize_upsample_pf_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
std
::
vector
<
float
>
ds
=
{
1.0
f
,
1.0
f
,
2.0
f
,
3.0
f
};
migraphx
::
shape
ss
{
migraphx
::
shape
::
float_type
,
{
4
}};
mm
->
add_literal
(
migraphx
::
literal
{
ss
,
ds
});
migraphx
::
shape
sx
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
2
,
2
}};
auto
inx
=
mm
->
add_parameter
(
"X"
,
sx
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"undefined"
));
migraphx
::
shape
si
{
migraphx
::
shape
::
int32_type
,
{
1
,
1
,
4
,
6
}};
std
::
vector
<
int
>
ind
=
{
0
,
0
,
0
,
1
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
2
,
2
,
2
,
3
,
3
,
3
,
2
,
2
,
2
,
3
,
3
,
3
};
auto
li
=
mm
->
add_literal
(
migraphx
::
literal
(
si
,
ind
));
auto
lrsp
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reshape"
,
{{
"dims"
,
{
4
}}}),
inx
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"gather"
,
{{
"axis"
,
0
}}),
lrsp
,
li
);
mm
->
add_return
({
r
});
auto
prog
=
migraphx
::
parse_onnx
(
"resize_upsample_pf_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/reversesequence_batch_axis_err_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
reversesequence_batch_axis_err_test
)
{
EXPECT
(
test
::
throws
([
&
]
{
migraphx
::
parse_onnx
(
"reversesequence_batch_axis_err_test.onnx"
);
}));
}
Prev
1
…
15
16
17
18
19
20
21
22
23
…
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