Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
d5b1b6c8
Commit
d5b1b6c8
authored
Oct 31, 2022
by
charlie
Browse files
separate tests
parent
fcc721d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
172 additions
and
152 deletions
+172
-152
test/op_shape_test.cpp
test/op_shape_test.cpp
+172
-152
No files found.
test/op_shape_test.cpp
View file @
d5b1b6c8
...
@@ -1114,160 +1114,180 @@ TEST_CASE(multibroadcast)
...
@@ -1114,160 +1114,180 @@ TEST_CASE(multibroadcast)
}
}
}
}
TEST_CASE
(
multibroadcast_2in
)
TEST_CASE
(
multibroadcast_2in
_static_dyn0
)
{
{
// static-dyn
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
4
,
4
}};
{
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
1
,
4
,
0
},
{
4
,
4
,
4
},
{
4
,
4
,
0
}};
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
4
,
4
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
1
,
4
,
0
},
{
4
,
4
,
4
},
{
4
,
4
,
0
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
4
,
4
,
0
},
{
4
,
4
,
0
}}},
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
migraphx
::
make_op
(
"multibroadcast"
),
expect_shape
(
a_shape
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
4
,
4
,
0
},
{
4
,
4
,
0
}}},
b_shape
);
migraphx
::
make_op
(
"multibroadcast"
),
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
4
,
4
,
0
},
{
4
,
4
,
0
}}},
a_shape
,
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
);
b_shape
,
expect_shape
(
a_shape
);
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
4
,
4
,
0
},
{
4
,
4
,
0
}}},
}
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
}
{
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
1
,
6
}};
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
8
,
8
,
0
},
{
6
,
6
,
0
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
8
,
8
,
0
},
{
6
,
6
,
0
}}},
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
8
,
8
,
0
},
{
6
,
6
,
0
}}},
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
}
{
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
6
}};
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
1
,
3
,
0
},
{
6
,
6
,
0
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
}
{
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
6
}};
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
1
,
4
,
0
},
{
6
,
6
,
0
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
}
{
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
6
}};
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
1
,
2
,
0
},
{
6
,
6
,
0
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
}
// dyn-dyn
TEST_CASE
(
multibroadcast_2in_static_dyn1
)
{
{
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
a
{{
1
,
4
,
0
},
{
2
,
4
,
2
},
{
2
,
4
,
0
}};
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
1
,
6
}};
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
a
};
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
8
,
8
,
0
},
{
6
,
6
,
0
}};
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
2
,
4
,
2
},
{
2
,
4
,
0
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
8
,
8
,
0
},
{
6
,
6
,
0
}}},
expect_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
2
,
4
,
2
},
{
2
,
4
,
0
}}},
a_shape
,
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
);
a_shape
,
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
8
,
8
,
0
},
{
6
,
6
,
0
}}},
b_shape
);
migraphx
::
make_op
(
"multibroadcast"
),
expect_shape
(
b_shape
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
2
,
4
,
2
},
{
2
,
4
,
0
}}},
a_shape
);
migraphx
::
make_op
(
"multibroadcast"
),
}
b_shape
,
a_shape
);
TEST_CASE
(
multibroadcast_2in_static_dyn_error0
)
}
{
{
// doesn't match on first dimension
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
a
{{
1
,
4
,
0
},
{
2
,
4
,
2
},
{
2
,
4
,
0
}};
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
6
}};
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
a
};
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
1
,
3
,
0
},
{
6
,
6
,
0
}};
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
2
,
5
,
2
},
{
2
,
4
,
0
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
}
}
{
TEST_CASE
(
multibroadcast_2in_static_dyn_error1
)
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
a
{{
1
,
4
,
0
},
{
2
,
4
,
2
},
{
2
,
4
,
0
}};
{
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
a
};
// doesn't match on first dimension
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
2
,
4
,
3
},
{
2
,
4
,
0
}};
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
6
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
1
,
4
,
0
},
{
6
,
6
,
0
}};
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
}
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
}
// static-static
{
TEST_CASE
(
multibroadcast_2in_static_dyn_error2
)
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
6
}};
{
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
6
}};
// doesn't match on first dimension
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
6
}},
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
6
}};
migraphx
::
make_op
(
"multibroadcast"
),
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
1
,
2
,
0
},
{
6
,
6
,
0
}};
a_shape
,
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
b_shape
);
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
6
}},
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
migraphx
::
make_op
(
"multibroadcast"
),
}
b_shape
,
a_shape
);
TEST_CASE
(
multibroadcast_2in_dyn_dyn0
)
}
{
{
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
a
{{
1
,
4
,
0
},
{
2
,
4
,
2
},
{
2
,
4
,
0
}};
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
1
,
8
}};
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
a
};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
4
,
8
}};
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
2
,
4
,
2
},
{
2
,
4
,
0
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
8
},
{
0
,
1
}},
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
migraphx
::
make_op
(
"multibroadcast"
),
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
2
,
4
,
2
},
{
2
,
4
,
0
}}},
a_shape
,
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
);
a_shape
,
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
8
},
{
8
,
1
}},
b_shape
);
migraphx
::
make_op
(
"multibroadcast"
),
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
,
0
},
{
2
,
4
,
2
},
{
2
,
4
,
0
}}},
b_shape
,
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
);
b_shape
,
}
a_shape
);
{
}
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
8
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
4
,
4
,
1
}};
TEST_CASE
(
multibroadcast_2in_dyn_dyn_error0
)
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
4
,
8
},
{
0
,
0
,
1
}},
{
migraphx
::
make_op
(
"multibroadcast"
),
// max doesn't match on second dimension of a
a_shape
,
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
a
{{
1
,
4
,
0
},
{
2
,
4
,
2
},
{
2
,
4
,
0
}};
b_shape
);
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
a
};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
4
,
8
},
{
4
,
1
,
0
}},
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
2
,
5
,
2
},
{
2
,
4
,
0
}};
migraphx
::
make_op
(
"multibroadcast"
),
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
b_shape
,
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
a_shape
);
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
}
}
{
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
4
}};
TEST_CASE
(
multibroadcast_2in_dyn_dyn_error1
)
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
4
,
1
}};
{
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
4
},
{
16
,
4
,
1
}},
// opt doesn't match on second dimension of a
migraphx
::
make_op
(
"multibroadcast"
),
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
a
{{
1
,
4
,
0
},
{
2
,
4
,
2
},
{
2
,
4
,
0
}};
a_shape
,
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
a
};
b_shape
);
std
::
vector
<
migraphx
::
shape
::
dynamic_dimension
>
b
{{
2
,
4
,
3
},
{
2
,
4
,
0
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
4
},
{
0
,
1
,
0
}},
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
b
};
migraphx
::
make_op
(
"multibroadcast"
),
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
b_shape
,
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
a_shape
);
}
}
{
TEST_CASE
(
multibroadcast_2in_static_static0
)
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
1
,
4
}};
{
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
4
,
1
}};
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
6
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
4
},
{
4
,
0
,
1
}},
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
6
}};
migraphx
::
make_op
(
"multibroadcast"
),
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
6
}},
a_shape
,
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
);
a_shape
,
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
4
},
{
0
,
1
,
0
}},
b_shape
);
migraphx
::
make_op
(
"multibroadcast"
),
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
6
}},
b_shape
,
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
);
b_shape
,
}
a_shape
);
{
}
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
4
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
4
,
3
}};
TEST_CASE
(
multibroadcast_2in_static_static1
)
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
{
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
1
,
8
}};
}
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
4
,
8
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
8
},
{
0
,
1
}},
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
8
},
{
8
,
1
}},
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
}
TEST_CASE
(
multibroadcast_2in_static_static2
)
{
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
8
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
4
,
4
,
1
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
4
,
8
},
{
0
,
0
,
1
}},
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
4
,
4
,
8
},
{
4
,
1
,
0
}},
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
}
TEST_CASE
(
multibroadcast_2in_static_static3
)
{
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
4
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
4
,
1
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
4
},
{
16
,
4
,
1
}},
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
4
},
{
0
,
1
,
0
}},
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
}
TEST_CASE
(
multibroadcast_2in_static_static4
)
{
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
1
,
4
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
4
,
1
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
4
},
{
4
,
0
,
1
}},
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
4
},
{
0
,
1
,
0
}},
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
}
TEST_CASE
(
multibroadcast_2in_static_static_error0
)
{
migraphx
::
shape
a_shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
4
}};
migraphx
::
shape
b_shape
{
migraphx
::
shape
::
float_type
,
{
4
,
3
}};
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
a_shape
,
b_shape
);
throws_shape
(
migraphx
::
make_op
(
"multibroadcast"
),
b_shape
,
a_shape
);
}
}
TEST_CASE
(
multinomial
)
TEST_CASE
(
multinomial
)
...
...
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