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
420 additions
and
0 deletions
+420
-0
test/onnx/parse/multinomial_test.cpp
test/onnx/parse/multinomial_test.cpp
+38
-0
test/onnx/parse/mvn_axes_rank_too_big_test.cpp
test/onnx/parse/mvn_axes_rank_too_big_test.cpp
+10
-0
test/onnx/parse/mvn_axes_rank_too_small_test.cpp
test/onnx/parse/mvn_axes_rank_too_small_test.cpp
+10
-0
test/onnx/parse/mvn_default_axes_rank_too_big_test.cpp
test/onnx/parse/mvn_default_axes_rank_too_big_test.cpp
+10
-0
test/onnx/parse/mvn_default_axes_rank_too_small_test.cpp
test/onnx/parse/mvn_default_axes_rank_too_small_test.cpp
+11
-0
test/onnx/parse/mvn_default_axes_test.cpp
test/onnx/parse/mvn_default_axes_test.cpp
+11
-0
test/onnx/parse/mvn_rank_3_test.cpp
test/onnx/parse/mvn_rank_3_test.cpp
+11
-0
test/onnx/parse/neg_dynamic_test.cpp
test/onnx/parse/neg_dynamic_test.cpp
+20
-0
test/onnx/parse/neg_test.cpp
test/onnx/parse/neg_test.cpp
+19
-0
test/onnx/parse/nms_dynamic_batch_test.cpp
test/onnx/parse/nms_dynamic_batch_test.cpp
+37
-0
test/onnx/parse/nms_dynamic_boxes_test.cpp
test/onnx/parse/nms_dynamic_boxes_test.cpp
+31
-0
test/onnx/parse/nms_dynamic_classes_test.cpp
test/onnx/parse/nms_dynamic_classes_test.cpp
+31
-0
test/onnx/parse/nms_test.cpp
test/onnx/parse/nms_test.cpp
+32
-0
test/onnx/parse/nms_use_dyn_output_false_test.cpp
test/onnx/parse/nms_use_dyn_output_false_test.cpp
+35
-0
test/onnx/parse/no_pad_test.cpp
test/onnx/parse/no_pad_test.cpp
+16
-0
test/onnx/parse/nonzero_dynamic_test.cpp
test/onnx/parse/nonzero_dynamic_test.cpp
+18
-0
test/onnx/parse/nonzero_int_test.cpp
test/onnx/parse/nonzero_int_test.cpp
+22
-0
test/onnx/parse/nonzero_test.cpp
test/onnx/parse/nonzero_test.cpp
+22
-0
test/onnx/parse/not_bool_test.cpp
test/onnx/parse/not_bool_test.cpp
+18
-0
test/onnx/parse/not_test.cpp
test/onnx/parse/not_test.cpp
+18
-0
No files found.
test/onnx/parse/multinomial_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
multinomial_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
size_t
sample_size
=
13
;
size_t
batch_size
=
3
;
size_t
categories
=
10
;
float
seed
=
0
;
auto
input
=
mm
->
add_parameter
(
"input"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
batch_size
,
categories
}});
auto
maxes
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reduce_max"
,
{{
"axes"
,
{
1
}}}),
input
);
auto
mb_maxes
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
batch_size
,
10
}}}),
maxes
);
auto
cdf
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"sub"
),
input
,
mb_maxes
);
cdf
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"exp"
),
cdf
);
cdf
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"prefix_scan_sum"
,
{{
"axis"
,
1
},
{
"exclusive"
,
false
}}),
cdf
);
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
1
}};
std
::
vector
<
float
>
seed_data
=
{
seed
};
auto
seed_input
=
mm
->
add_literal
(
migraphx
::
literal
(
s
,
seed_data
));
auto
rand_dummy
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
batch_size
,
sample_size
}},
std
::
vector
<
float
>
(
batch_size
*
sample_size
)});
auto
randoms
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"random_uniform"
),
seed_input
,
rand_dummy
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"multinomial"
),
cdf
,
randoms
);
auto
prog
=
optimize_onnx
(
"multinomial_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/mvn_axes_rank_too_big_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
mvn_axes_rank_too_big_test
)
{
EXPECT
(
test
::
throws
([
&
]
{
migraphx
::
parse_onnx
(
"mvn_axes_rank_too_big_test.onnx"
);
}));
}
test/onnx/parse/mvn_axes_rank_too_small_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
mvn_axes_rank_too_small_test
)
{
EXPECT
(
test
::
throws
([
&
]
{
migraphx
::
parse_onnx
(
"mvn_axes_rank_too_small_test.onnx"
);
}));
}
test/onnx/parse/mvn_default_axes_rank_too_big_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
mvn_default_axes_rank_too_big_test
)
{
EXPECT
(
test
::
throws
([
&
]
{
migraphx
::
parse_onnx
(
"mvn_default_axes_rank_too_big_test.onnx"
);
}));
}
test/onnx/parse/mvn_default_axes_rank_too_small_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
mvn_default_axes_rank_too_small_test
)
{
EXPECT
(
test
::
throws
([
&
]
{
migraphx
::
parse_onnx
(
"mvn_default_axes_rank_too_small_test.onnx"
);
}));
}
test/onnx/parse/mvn_default_axes_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
#include <onnx_test_utils.hpp>
TEST_CASE
(
mvn_default_axes_test
)
{
mvn_n_rank_test
({
0
,
2
,
3
},
{
2
,
2
,
2
,
2
},
optimize_onnx
(
"mvn_default_axes_test.onnx"
));
}
test/onnx/parse/mvn_rank_3_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
#include <onnx_test_utils.hpp>
TEST_CASE
(
mvn_rank_3_test
)
{
mvn_n_rank_test
({
0
,
1
},
{
2
,
2
,
2
},
optimize_onnx
(
"mvn_rank_3_test.onnx"
));
}
test/onnx/parse/neg_dynamic_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
neg_dynamic_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
int64_type
,
{{
1
,
10
},
{
3
,
3
}}};
auto
input
=
mm
->
add_parameter
(
"0"
,
s
);
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"neg"
),
input
);
mm
->
add_return
({
ret
});
migraphx
::
onnx_options
options
;
options
.
default_dyn_dim_value
=
{
1
,
10
};
auto
prog
=
migraphx
::
parse_onnx
(
"neg_dynamic_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/neg_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
neg_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
int64_type
,
{
2
,
3
}};
auto
input
=
mm
->
add_parameter
(
"0"
,
s
);
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"neg"
),
input
);
mm
->
add_return
({
ret
});
auto
prog
=
migraphx
::
parse_onnx
(
"neg_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/nms_dynamic_batch_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
nms_dynamic_batch_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
sb
{
migraphx
::
shape
::
float_type
,
{{
1
,
10
},
{
6
,
6
},
{
4
,
4
}}};
auto
b
=
mm
->
add_parameter
(
"boxes"
,
sb
);
migraphx
::
shape
ss
{
migraphx
::
shape
::
float_type
,
{{
1
,
10
},
{
1
,
1
},
{
6
,
6
}}};
auto
s
=
mm
->
add_parameter
(
"scores"
,
ss
);
migraphx
::
shape
smo
{
migraphx
::
shape
::
int64_type
,
{
1
}};
auto
mo
=
mm
->
add_parameter
(
"max_output_boxes_per_class"
,
smo
);
migraphx
::
shape
siou
{
migraphx
::
shape
::
float_type
,
{
1
}};
auto
iou
=
mm
->
add_parameter
(
"iou_threshold"
,
siou
);
migraphx
::
shape
sst
{
migraphx
::
shape
::
float_type
,
{
1
}};
auto
st
=
mm
->
add_parameter
(
"score_threshold"
,
sst
);
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"nonmaxsuppression"
,
{{
"center_point_box"
,
true
},
{
"use_dyn_output"
,
true
}}),
b
,
s
,
mo
,
iou
,
st
);
mm
->
add_return
({
ret
});
migraphx
::
onnx_options
options
;
options
.
default_dyn_dim_value
=
{
1
,
10
};
options
.
use_dyn_output
=
true
;
auto
prog
=
migraphx
::
parse_onnx
(
"nms_dynamic_batch_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/nms_dynamic_boxes_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
nms_dynamic_boxes_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
sb
{
migraphx
::
shape
::
float_type
,
{{
1
,
1
},
{
6
,
20
},
{
4
,
4
}}};
auto
b
=
mm
->
add_parameter
(
"boxes"
,
sb
);
migraphx
::
shape
ss
{
migraphx
::
shape
::
float_type
,
{{
1
,
1
},
{
1
,
1
},
{
6
,
20
}}};
auto
s
=
mm
->
add_parameter
(
"scores"
,
ss
);
migraphx
::
shape
smo
{
migraphx
::
shape
::
int64_type
,
{
1
}};
auto
mo
=
mm
->
add_parameter
(
"max_output_boxes_per_class"
,
smo
);
migraphx
::
shape
siou
{
migraphx
::
shape
::
float_type
,
{
1
}};
auto
iou
=
mm
->
add_parameter
(
"iou_threshold"
,
siou
);
migraphx
::
shape
sst
{
migraphx
::
shape
::
float_type
,
{
1
}};
auto
st
=
mm
->
add_parameter
(
"score_threshold"
,
sst
);
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"nonmaxsuppression"
,
{{
"use_dyn_output"
,
true
}}),
b
,
s
,
mo
,
iou
,
st
);
mm
->
add_return
({
ret
});
migraphx
::
onnx_options
options
;
options
.
default_dyn_dim_value
=
{
6
,
20
};
options
.
use_dyn_output
=
true
;
auto
prog
=
migraphx
::
parse_onnx
(
"nms_dynamic_boxes_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/nms_dynamic_classes_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
nms_dynamic_classes_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
sb
{
migraphx
::
shape
::
float_type
,
{
1
,
6
,
4
}};
auto
b
=
mm
->
add_parameter
(
"boxes"
,
sb
);
migraphx
::
shape
ss
{
migraphx
::
shape
::
float_type
,
{{
1
,
1
},
{
1
,
10
},
{
6
,
6
}}};
auto
s
=
mm
->
add_parameter
(
"scores"
,
ss
);
migraphx
::
shape
smo
{
migraphx
::
shape
::
int64_type
,
{
1
}};
auto
mo
=
mm
->
add_parameter
(
"max_output_boxes_per_class"
,
smo
);
migraphx
::
shape
siou
{
migraphx
::
shape
::
float_type
,
{
1
}};
auto
iou
=
mm
->
add_parameter
(
"iou_threshold"
,
siou
);
migraphx
::
shape
sst
{
migraphx
::
shape
::
float_type
,
{
1
}};
auto
st
=
mm
->
add_parameter
(
"score_threshold"
,
sst
);
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"nonmaxsuppression"
,
{{
"use_dyn_output"
,
true
}}),
b
,
s
,
mo
,
iou
,
st
);
mm
->
add_return
({
ret
});
migraphx
::
onnx_options
options
;
options
.
default_dyn_dim_value
=
{
1
,
10
};
options
.
use_dyn_output
=
true
;
auto
prog
=
migraphx
::
parse_onnx
(
"nms_dynamic_classes_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/nms_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
nms_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
sb
{
migraphx
::
shape
::
float_type
,
{
1
,
6
,
4
}};
auto
b
=
mm
->
add_parameter
(
"boxes"
,
sb
);
migraphx
::
shape
ss
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
6
}};
auto
s
=
mm
->
add_parameter
(
"scores"
,
ss
);
migraphx
::
shape
smo
{
migraphx
::
shape
::
int64_type
,
{
1
}};
auto
mo
=
mm
->
add_parameter
(
"max_output_boxes_per_class"
,
smo
);
migraphx
::
shape
siou
{
migraphx
::
shape
::
float_type
,
{
1
}};
auto
iou
=
mm
->
add_parameter
(
"iou_threshold"
,
siou
);
migraphx
::
shape
sst
{
migraphx
::
shape
::
float_type
,
{
1
}};
auto
st
=
mm
->
add_parameter
(
"score_threshold"
,
sst
);
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"nonmaxsuppression"
,
{{
"center_point_box"
,
true
}}),
b
,
s
,
mo
,
iou
,
st
);
mm
->
add_return
({
ret
});
auto
prog
=
migraphx
::
parse_onnx
(
"nms_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/nms_use_dyn_output_false_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
nms_overwrite_use_dyn_output_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
sb
{
migraphx
::
shape
::
float_type
,
{
1
,
6
,
4
}};
auto
b
=
mm
->
add_parameter
(
"boxes"
,
sb
);
migraphx
::
shape
ss
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
6
}};
auto
s
=
mm
->
add_parameter
(
"scores"
,
ss
);
migraphx
::
shape
smo
{
migraphx
::
shape
::
int64_type
,
{
1
}};
auto
mo
=
mm
->
add_parameter
(
"max_output_boxes_per_class"
,
smo
);
migraphx
::
shape
siou
{
migraphx
::
shape
::
float_type
,
{
1
}};
auto
iou
=
mm
->
add_parameter
(
"iou_threshold"
,
siou
);
migraphx
::
shape
sst
{
migraphx
::
shape
::
float_type
,
{
1
}};
auto
st
=
mm
->
add_parameter
(
"score_threshold"
,
sst
);
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"nonmaxsuppression"
,
{{
"use_dyn_output"
,
true
}}),
b
,
s
,
mo
,
iou
,
st
);
mm
->
add_return
({
ret
});
migraphx
::
onnx_options
options
;
options
.
use_dyn_output
=
true
;
auto
prog
=
migraphx
::
parse_onnx
(
"nms_use_dyn_output_false_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/no_pad_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
no_pad_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"identity"
),
l0
);
auto
prog
=
optimize_onnx
(
"no_pad_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/nonzero_dynamic_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
nonzero_dynamic_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
bool_type
,
{
2
,
2
}};
auto
data
=
mm
->
add_parameter
(
"data"
,
s
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"nonzero"
),
data
);
mm
->
add_return
({
r
});
auto
prog
=
migraphx
::
parse_onnx
(
"nonzero_dynamic_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/nonzero_int_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
nonzero_int_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
int16_type
,
{
2
,
3
}};
std
::
vector
<
int
>
data
=
{
1
,
1
,
0
,
1
,
0
,
1
};
mm
->
add_literal
(
migraphx
::
literal
(
s
,
data
.
begin
(),
data
.
end
()));
migraphx
::
shape
si
{
migraphx
::
shape
::
int64_type
,
{
2
,
4
}};
std
::
vector
<
int64_t
>
indices
=
{
0
,
0
,
1
,
1
,
0
,
1
,
0
,
2
};
auto
r
=
mm
->
add_literal
(
migraphx
::
literal
(
si
,
indices
));
mm
->
add_return
({
r
});
auto
prog
=
migraphx
::
parse_onnx
(
"nonzero_int_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/nonzero_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
nonzero_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}};
std
::
vector
<
float
>
data
=
{
1
,
0
,
1
,
1
};
mm
->
add_literal
(
migraphx
::
literal
(
s
,
data
));
migraphx
::
shape
si
{
migraphx
::
shape
::
int64_type
,
{
2
,
3
}};
std
::
vector
<
int64_t
>
indices
=
{
0
,
1
,
1
,
0
,
0
,
1
};
auto
r
=
mm
->
add_literal
(
migraphx
::
literal
(
si
,
indices
));
mm
->
add_return
({
r
});
auto
prog
=
migraphx
::
parse_onnx
(
"nonzero_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/not_bool_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
not_bool_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
bool_type
,
{
4
}});
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"not"
),
l0
);
mm
->
add_return
({
ret
});
auto
prog
=
migraphx
::
parse_onnx
(
"not_bool_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/not_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
not_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{
4
}});
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"not"
),
l0
);
mm
->
add_return
({
ret
});
auto
prog
=
migraphx
::
parse_onnx
(
"not_test.onnx"
);
EXPECT
(
p
==
prog
);
}
Prev
1
…
11
12
13
14
15
16
17
18
19
…
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