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
436 additions
and
0 deletions
+436
-0
test/onnx/parse/tan_test.cpp
test/onnx/parse/tan_test.cpp
+16
-0
test/onnx/parse/tanh_test.cpp
test/onnx/parse/tanh_test.cpp
+17
-0
test/onnx/parse/thresholdedrelu_default_test.cpp
test/onnx/parse/thresholdedrelu_default_test.cpp
+24
-0
test/onnx/parse/thresholdedrelu_int_test.cpp
test/onnx/parse/thresholdedrelu_int_test.cpp
+24
-0
test/onnx/parse/thresholdedrelu_test.cpp
test/onnx/parse/thresholdedrelu_test.cpp
+24
-0
test/onnx/parse/tile_test.cpp
test/onnx/parse/tile_test.cpp
+18
-0
test/onnx/parse/tile_test_3x2.cpp
test/onnx/parse/tile_test_3x2.cpp
+20
-0
test/onnx/parse/topk_attrk_test.cpp
test/onnx/parse/topk_attrk_test.cpp
+21
-0
test/onnx/parse/topk_neg_axis_test.cpp
test/onnx/parse/topk_neg_axis_test.cpp
+24
-0
test/onnx/parse/topk_test.cpp
test/onnx/parse/topk_test.cpp
+24
-0
test/onnx/parse/transpose_default_perm_test.cpp
test/onnx/parse/transpose_default_perm_test.cpp
+19
-0
test/onnx/parse/transpose_dyn_test.cpp
test/onnx/parse/transpose_dyn_test.cpp
+22
-0
test/onnx/parse/transpose_gather_test.cpp
test/onnx/parse/transpose_gather_test.cpp
+36
-0
test/onnx/parse/transpose_invalid_perm_test.cpp
test/onnx/parse/transpose_invalid_perm_test.cpp
+10
-0
test/onnx/parse/transpose_test.cpp
test/onnx/parse/transpose_test.cpp
+18
-0
test/onnx/parse/undefined_test.cpp
test/onnx/parse/undefined_test.cpp
+19
-0
test/onnx/parse/unique_dynamic_sorted_3D_test.cpp
test/onnx/parse/unique_dynamic_sorted_3D_test.cpp
+25
-0
test/onnx/parse/unique_dynamic_sorted_test.cpp
test/onnx/parse/unique_dynamic_sorted_test.cpp
+25
-0
test/onnx/parse/unique_sorted_test.cpp
test/onnx/parse/unique_sorted_test.cpp
+25
-0
test/onnx/parse/unique_unsorted_test.cpp
test/onnx/parse/unique_unsorted_test.cpp
+25
-0
No files found.
test/onnx/parse/tan_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
tan_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
(
"tan"
),
input
);
auto
prog
=
optimize_onnx
(
"tan_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/tanh_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
tanh_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
input
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"tanh"
),
input
);
auto
prog
=
optimize_onnx
(
"tanh_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/thresholdedrelu_default_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
thresholdedrelu_default_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
2
,
3
}});
auto
lz
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
x
->
get_shape
().
type
()},
{
0
}});
auto
la
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
x
->
get_shape
().
type
()},
{
1.0
f
}});
auto
mbz
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
x
->
get_shape
().
lens
()}}),
lz
);
auto
mba
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
x
->
get_shape
().
lens
()}}),
la
);
auto
condition
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"greater"
),
x
,
mba
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"where"
),
condition
,
x
,
mbz
);
auto
prog
=
optimize_onnx
(
"thresholdedrelu_default_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/thresholdedrelu_int_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
thresholdedrelu_int_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{
2
,
2
,
3
}});
auto
lz
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
x
->
get_shape
().
type
()},
{
0
}});
auto
la
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
x
->
get_shape
().
type
()},
{
3
}});
auto
mbz
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
x
->
get_shape
().
lens
()}}),
lz
);
auto
mba
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
x
->
get_shape
().
lens
()}}),
la
);
auto
condition
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"greater"
),
x
,
mba
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"where"
),
condition
,
x
,
mbz
);
auto
prog
=
optimize_onnx
(
"thresholdedrelu_int_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/thresholdedrelu_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
thresholdedrelu_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
2
,
3
}});
auto
lz
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
x
->
get_shape
().
type
()},
{
0
}});
auto
la
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
x
->
get_shape
().
type
()},
{
3.0
f
}});
auto
mbz
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
x
->
get_shape
().
lens
()}}),
lz
);
auto
mba
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
x
->
get_shape
().
lens
()}}),
la
);
auto
condition
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"greater"
),
x
,
mba
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"where"
),
condition
,
x
,
mbz
);
auto
prog
=
optimize_onnx
(
"thresholdedrelu_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/tile_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
tile_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
int64_type
,
{
2
}},
{
1
,
2
}});
auto
input
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
1
}}),
input
,
input
);
auto
prog
=
optimize_onnx
(
"tile_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/tile_test_3x2.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
tile_test_3x2
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
int64_type
,
{
2
}},
{
3
,
2
}});
auto
input
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}});
auto
l0
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
0
}}),
input
,
input
);
auto
l1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
0
}}),
l0
,
input
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
1
}}),
l1
,
l1
);
auto
prog
=
optimize_onnx
(
"tile_test_3x2.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/topk_attrk_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
topk_attrk_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
5
,
3
,
2
}};
auto
data
=
mm
->
add_parameter
(
"data"
,
s
);
auto
out
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"topk"
,
{{
"k"
,
2
},
{
"axis"
,
-
1
}}),
data
);
auto
val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
0
}}),
out
);
auto
ind
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
1
}}),
out
);
mm
->
add_return
({
val
,
ind
});
auto
prog
=
migraphx
::
parse_onnx
(
"topk_attrk_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/topk_neg_axis_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
topk_neg_axis_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
sk
{
migraphx
::
shape
::
int64_type
,
{
1
}};
mm
->
add_literal
(
migraphx
::
literal
(
sk
,
{
3
}));
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}};
auto
data
=
mm
->
add_parameter
(
"data"
,
s
);
auto
out
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"topk"
,
{{
"k"
,
3
},
{
"axis"
,
-
2
},
{
"largest"
,
1
}}),
data
);
auto
val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
0
}}),
out
);
auto
ind
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
1
}}),
out
);
mm
->
add_return
({
val
,
ind
});
auto
prog
=
migraphx
::
parse_onnx
(
"topk_neg_axis_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/topk_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
topk_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
sk
{
migraphx
::
shape
::
int64_type
,
{
1
}};
mm
->
add_literal
(
migraphx
::
literal
(
sk
,
{
4
}));
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
5
,
3
,
2
}};
auto
data
=
mm
->
add_parameter
(
"data"
,
s
);
auto
out
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"topk"
,
{{
"k"
,
4
},
{
"axis"
,
1
},
{
"largest"
,
0
}}),
data
);
auto
val
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
0
}}),
out
);
auto
ind
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
1
}}),
out
);
mm
->
add_return
({
val
,
ind
});
auto
prog
=
migraphx
::
parse_onnx
(
"topk_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/transpose_default_perm_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
transpose_default_perm_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
input
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
5
,
2
,
3
}});
std
::
vector
<
int64_t
>
perm
{
3
,
2
,
1
,
0
};
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
perm
}}),
input
);
mm
->
add_return
({
r
});
auto
prog
=
migraphx
::
parse_onnx
(
"transpose_default_perm_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/transpose_dyn_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
transpose_dyn_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
input
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
},
{
2
,
2
},
{
2
,
2
},
{
3
,
3
}}});
std
::
vector
<
int64_t
>
perm
{
0
,
3
,
1
,
2
};
auto
t0
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
perm
}}),
input
);
mm
->
add_return
({
t0
});
migraphx
::
onnx_options
options
;
options
.
default_dyn_dim_value
=
{
1
,
4
};
auto
prog
=
migraphx
::
parse_onnx
(
"transpose_dyn_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/transpose_gather_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
transpose_gather_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
make_contiguous
=
[
&
mm
](
migraphx
::
instruction_ref
ins
)
{
if
(
ins
->
get_shape
().
standard
())
{
return
ins
;
}
return
mm
->
add_instruction
(
migraphx
::
make_op
(
"contiguous"
),
ins
);
};
auto
data
=
mm
->
add_parameter
(
"data"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
5
,
4
,
6
}});
auto
ind
=
mm
->
add_parameter
(
"indices"
,
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{
2
,
4
,
3
,
5
}});
auto
tr_data
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
0
,
2
,
1
,
3
}}}),
data
);
auto
tr_ind
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
{
0
,
2
,
1
,
3
}}}),
ind
);
int
axis
=
1
;
mm
->
add_instruction
(
migraphx
::
make_op
(
"gather"
,
{{
"axis"
,
axis
}}),
make_contiguous
(
tr_data
),
make_contiguous
(
tr_ind
));
auto
prog
=
optimize_onnx
(
"transpose_gather_test.onnx"
);
EXPECT
(
p
.
sort
()
==
prog
.
sort
());
}
test/onnx/parse/transpose_invalid_perm_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
transpose_invalid_perm_test
)
{
EXPECT
(
test
::
throws
([
&
]
{
migraphx
::
parse_onnx
(
"transpose_invalid_perm_test.onnx"
);
}));
}
test/onnx/parse/transpose_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
transpose_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
input
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
2
,
2
,
3
}});
std
::
vector
<
int64_t
>
perm
{
0
,
3
,
1
,
2
};
mm
->
add_instruction
(
migraphx
::
make_op
(
"transpose"
,
{{
"permutation"
,
perm
}}),
input
);
auto
prog
=
optimize_onnx
(
"transpose_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/undefined_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
undefined_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
,
5
}});
auto
l1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"undefined"
));
auto
l2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"identity"
),
l1
);
mm
->
add_return
({
l2
});
auto
prog
=
migraphx
::
parse_onnx
(
"undefined_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/unique_dynamic_sorted_3D_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
unique_dynamic_sorted_3D_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
int64_type
,
{
4
,
4
,
4
}};
auto
x
=
mm
->
add_parameter
(
"X"
,
s
);
auto
out
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unique"
,
{{
"sorted"
,
1
}}),
x
);
auto
y
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
0
}}),
out
);
auto
y_ind
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
1
}}),
out
);
auto
x_ind
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
2
}}),
out
);
auto
count
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
3
}}),
out
);
mm
->
add_return
({
y
,
y_ind
,
x_ind
,
count
});
auto
prog
=
migraphx
::
parse_onnx
(
"unique_dynamic_sorted_3D_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/unique_dynamic_sorted_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
unique_dynamic_sorted_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
6
}};
auto
x
=
mm
->
add_parameter
(
"X"
,
s
);
auto
out
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unique"
,
{{
"sorted"
,
1
},
{
"axis"
,
0
}}),
x
);
auto
y
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
0
}}),
out
);
auto
y_ind
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
1
}}),
out
);
auto
x_ind
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
2
}}),
out
);
auto
count
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
3
}}),
out
);
mm
->
add_return
({
y
,
y_ind
,
x_ind
,
count
});
auto
prog
=
migraphx
::
parse_onnx
(
"unique_dynamic_sorted_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/unique_sorted_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
unique_sorted_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s_x
{
migraphx
::
shape
::
float_type
,
{
6
}};
std
::
vector
<
float
>
x_data
=
{
2
,
1
,
1
,
3
,
4
,
3
};
auto
x
=
mm
->
add_literal
(
migraphx
::
literal
(
s_x
,
x_data
));
auto
out
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unique"
,
{{
"sorted"
,
1
},
{
"axis"
,
0
}}),
x
);
auto
y
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
0
}}),
out
);
auto
y_idx
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
1
}}),
out
);
auto
x_idx
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
2
}}),
out
);
auto
count
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
3
}}),
out
);
mm
->
add_return
({
y
,
y_idx
,
x_idx
,
count
});
auto
prog
=
migraphx
::
parse_onnx
(
"unique_sorted_test.onnx"
);
EXPECT
(
p
==
prog
);
}
test/onnx/parse/unique_unsorted_test.cpp
0 → 100644
View file @
93c89587
#include <onnx_test.hpp>
TEST_CASE
(
unique_unsorted_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s_x
{
migraphx
::
shape
::
float_type
,
{
6
}};
std
::
vector
<
float
>
x_data
=
{
2
,
1
,
1
,
3
,
4
,
3
};
auto
x
=
mm
->
add_literal
(
migraphx
::
literal
(
s_x
,
x_data
));
auto
out
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unique"
,
{{
"sorted"
,
0
},
{
"axis"
,
0
}}),
x
);
auto
y
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
0
}}),
out
);
auto
y_idx
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
1
}}),
out
);
auto
x_idx
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
2
}}),
out
);
auto
count
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"get_tuple_elem"
,
{{
"index"
,
3
}}),
out
);
mm
->
add_return
({
y
,
y_idx
,
x_idx
,
count
});
auto
prog
=
migraphx
::
parse_onnx
(
"unique_unsorted_test.onnx"
);
EXPECT
(
p
==
prog
);
}
Prev
1
…
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