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
332 additions
and
0 deletions
+332
-0
test/onnx/parse/const_of_shape_dyn_int64_test.cpp
test/onnx/parse/const_of_shape_dyn_int64_test.cpp
+23
-0
test/onnx/parse/const_of_shape_empty_input_test.cpp
test/onnx/parse/const_of_shape_empty_input_test.cpp
+18
-0
test/onnx/parse/const_of_shape_float_test.cpp
test/onnx/parse/const_of_shape_float_test.cpp
+19
-0
test/onnx/parse/const_of_shape_int64_test.cpp
test/onnx/parse/const_of_shape_int64_test.cpp
+21
-0
test/onnx/parse/const_of_shape_no_value_attr_test.cpp
test/onnx/parse/const_of_shape_no_value_attr_test.cpp
+19
-0
test/onnx/parse/constant_empty_scalar_int64_test.cpp
test/onnx/parse/constant_empty_scalar_int64_test.cpp
+15
-0
test/onnx/parse/constant_fill_input_as_shape_test.cpp
test/onnx/parse/constant_fill_input_as_shape_test.cpp
+21
-0
test/onnx/parse/constant_fill_test.cpp
test/onnx/parse/constant_fill_test.cpp
+17
-0
test/onnx/parse/constant_multiple_attributes_test.cpp
test/onnx/parse/constant_multiple_attributes_test.cpp
+10
-0
test/onnx/parse/constant_no_attributes_test.cpp
test/onnx/parse/constant_no_attributes_test.cpp
+10
-0
test/onnx/parse/constant_one_val_int64_test.cpp
test/onnx/parse/constant_one_val_int64_test.cpp
+15
-0
test/onnx/parse/constant_scalar_test.cpp
test/onnx/parse/constant_scalar_test.cpp
+15
-0
test/onnx/parse/constant_test.cpp
test/onnx/parse/constant_test.cpp
+16
-0
test/onnx/parse/constant_value_float_test.cpp
test/onnx/parse/constant_value_float_test.cpp
+15
-0
test/onnx/parse/constant_value_floats_test.cpp
test/onnx/parse/constant_value_floats_test.cpp
+16
-0
test/onnx/parse/constant_value_int_test.cpp
test/onnx/parse/constant_value_int_test.cpp
+15
-0
test/onnx/parse/constant_value_ints_test.cpp
test/onnx/parse/constant_value_ints_test.cpp
+16
-0
test/onnx/parse/conv_1d_test.cpp
test/onnx/parse/conv_1d_test.cpp
+20
-0
test/onnx/parse/conv_3d_test.cpp
test/onnx/parse/conv_3d_test.cpp
+21
-0
test/onnx/parse/conv_attr_fail_test.cpp
test/onnx/parse/conv_attr_fail_test.cpp
+10
-0
No files found.
test/onnx/parse/const_of_shape_dyn_int64_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
const_of_shape_dyn_int64_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
od_param
=
mm
->
add_parameter
(
"output_dims"
,
migraphx
::
shape
{
migraphx
::
shape
::
int64_type
,
{
3
}});
auto
alloc_ins
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"allocate"
,
{{
"buf_type"
,
migraphx
::
shape
::
int64_type
}}),
od_param
);
migraphx
::
shape
dv_shape
(
migraphx
::
shape
::
int64_type
,
{
1
},
{
0
});
auto
dv_lit
=
mm
->
add_literal
(
migraphx
::
literal
(
dv_shape
,
{
10
}));
auto
fill_ins
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"fill"
),
dv_lit
,
alloc_ins
);
mm
->
add_return
({
fill_ins
});
migraphx
::
onnx_options
options
;
auto
prog
=
parse_onnx
(
"const_of_shape_dyn_int64_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/const_of_shape_empty_input_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
const_of_shape_empty_input_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_literal
(
migraphx
::
literal
(
migraphx
::
shape
::
int64_type
));
migraphx
::
shape
s
(
migraphx
::
shape
::
int64_type
,
{
1
},
{
0
});
std
::
vector
<
int64_t
>
vec
(
s
.
elements
(),
10
);
mm
->
add_literal
(
migraphx
::
literal
(
s
,
vec
));
auto
prog
=
optimize_onnx
(
"const_of_shape_empty_input_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/const_of_shape_float_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
const_of_shape_float_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
ss
(
migraphx
::
shape
::
int64_type
,
{
3
});
mm
->
add_literal
(
migraphx
::
literal
(
ss
,
{
2
,
3
,
4
}));
migraphx
::
shape
s
(
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
});
std
::
vector
<
float
>
vec
(
s
.
elements
(),
10.0
f
);
mm
->
add_literal
(
migraphx
::
literal
(
s
,
vec
));
auto
prog
=
optimize_onnx
(
"const_of_shape_float_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/const_of_shape_int64_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
const_of_shape_int64_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
// output_dims
migraphx
::
shape
ss
(
migraphx
::
shape
::
int64_type
,
{
3
});
mm
->
add_literal
(
migraphx
::
literal
(
ss
,
{
2
,
3
,
4
}));
// constant shape literal
migraphx
::
shape
s
(
migraphx
::
shape
::
int64_type
,
{
2
,
3
,
4
});
std
::
vector
<
int64_t
>
vec
(
s
.
elements
(),
10
);
mm
->
add_literal
(
migraphx
::
literal
(
s
,
vec
));
auto
prog
=
optimize_onnx
(
"const_of_shape_int64_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/const_of_shape_no_value_attr_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
const_of_shape_no_value_attr_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
ss
(
migraphx
::
shape
::
int64_type
,
{
3
});
mm
->
add_literal
(
migraphx
::
literal
(
ss
,
{
2
,
3
,
4
}));
migraphx
::
shape
s
(
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
});
std
::
vector
<
float
>
vec
(
s
.
elements
(),
0.0
f
);
mm
->
add_literal
(
migraphx
::
literal
(
s
,
vec
));
auto
prog
=
optimize_onnx
(
"const_of_shape_no_value_attr_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/constant_empty_scalar_int64_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
constant_empty_scalar_int64_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
::
int64_type
});
auto
prog
=
optimize_onnx
(
"constant_empty_scalar_int64_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/constant_fill_input_as_shape_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
constant_fill_input_as_shape_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_literal
(
migraphx
::
literal
{{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
2
,
3
}});
std
::
vector
<
std
::
size_t
>
dims
(
l0
->
get_shape
().
elements
());
migraphx
::
literal
ls
=
l0
->
get_literal
();
ls
.
visit
([
&
](
auto
s
)
{
dims
.
assign
(
s
.
begin
(),
s
.
end
());
});
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
dims
};
std
::
vector
<
float
>
value
(
s
.
elements
(),
1.0
);
mm
->
add_literal
(
migraphx
::
literal
{
s
,
value
});
auto
prog
=
optimize_onnx
(
"constant_fill_input_as_shape_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/constant_fill_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
constant_fill_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
3
}};
std
::
vector
<
float
>
value
(
s
.
elements
(),
1.0
);
mm
->
add_literal
(
migraphx
::
literal
{
s
,
value
});
auto
prog
=
optimize_onnx
(
"constant_fill_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/constant_multiple_attributes_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
constant_multiple_attributes_test
)
{
EXPECT
(
test
::
throws
([
&
]
{
optimize_onnx
(
"constant_multiple_attributes_test.onnx"
);
}));
}
test/onnx/parse/constant_no_attributes_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
constant_no_attributes_test
)
{
EXPECT
(
test
::
throws
([
&
]
{
optimize_onnx
(
"constant_no_attributes_test.onnx"
);
}));
}
test/onnx/parse/constant_one_val_int64_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
constant_one_val_int64_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
int64_type
,
{
1
}},
{
1
}});
auto
prog
=
optimize_onnx
(
"constant_one_val_int64_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/constant_scalar_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
constant_scalar_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{
1
}},
{
1
}});
auto
prog
=
optimize_onnx
(
"constant_scalar_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/constant_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
constant_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
}},
{
0
,
1
,
2
}});
auto
prog
=
optimize_onnx
(
"constant_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/constant_value_float_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
constant_value_float_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
}},
{
1.0
f
}});
auto
prog
=
optimize_onnx
(
"constant_value_float_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/constant_value_floats_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
constant_value_floats_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
}},
{
1.0
f
,
2.0
f
,
3.0
f
}});
auto
prog
=
optimize_onnx
(
"constant_value_floats_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/constant_value_int_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
constant_value_int_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
int64_type
,
{
1
}},
{
1
}});
auto
prog
=
optimize_onnx
(
"constant_value_int_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/constant_value_ints_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
constant_value_ints_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
int64_type
,
{
3
}},
{
1
,
2
,
3
}});
auto
prog
=
optimize_onnx
(
"constant_value_ints_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/conv_1d_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
conv_1d_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"0"
,
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
5
}});
auto
l1
=
mm
->
add_parameter
(
"1"
,
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
3
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"convolution"
,
{{
"padding"
,
{
0
}},
{
"stride"
,
{
1
}},
{
"dilation"
,
{
1
}}}),
l0
,
l1
);
auto
prog
=
optimize_onnx
(
"conv_1d_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/conv_3d_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
conv_3d_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"0"
,
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
5
,
5
,
5
}});
auto
l1
=
mm
->
add_parameter
(
"1"
,
{
migraphx
::
shape
::
float_type
,
{
1
,
3
,
3
,
3
,
3
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"convolution"
,
{{
"padding"
,
{
0
,
0
,
0
}},
{
"stride"
,
{
1
,
1
,
1
}},
{
"dilation"
,
{
1
,
1
,
1
}}}),
l0
,
l1
);
auto
prog
=
optimize_onnx
(
"conv_3d_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/conv_attr_fail_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
conv_attr_fail_test
)
{
EXPECT
(
test
::
throws
([
&
]
{
migraphx
::
parse_onnx
(
"conv_attr_fail_test.onnx"
);
}));
}
Prev
1
2
3
4
5
6
7
8
…
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