Skip to content

Commit

Permalink
Fix onnx test loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
mirza-halilcevic committed May 29, 2024
1 parent bc7d5cb commit 2542894
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 70 deletions.
2 changes: 1 addition & 1 deletion src/onnx/parse_einsum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ struct parse_einsum : op_parser<parse_einsum>
const std::map<char, int>& label_count,
size_t ellipsis_ndim) const
{
const auto* it = std::find_if(output_term.begin(), output_term.end(), [&](auto l) {
const auto it = std::find_if(output_term.begin(), output_term.end(), [&](auto l) {

Check warning on line 242 in src/onnx/parse_einsum.cpp

View workflow job for this annotation

GitHub Actions / tidy

'const auto it' can be declared as 'const auto *const it' [readability-qualified-auto,-warnings-as-errors]
return not contains(label_count, l) and l != '*';
});
if(it != output_term.end())
Expand Down
44 changes: 15 additions & 29 deletions test/onnx/parse/einsum_negative_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,89 +26,75 @@

TEST_CASE(einsum_missing_equation_negative_test)
{
EXPECT(
test::throws([&] { migraphx::parse_onnx("einsum_missing_equation_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_missing_equation_negative_test.onnx"); }));
}

TEST_CASE(einsum_multiple_arrows_negative_test)
{
EXPECT(
test::throws([&] { migraphx::parse_onnx("einsum_multiple_arrows_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_multiple_arrows_negative_test.onnx"); }));
}

TEST_CASE(einsum_empty_term_before_arrow_negative_test)
{
EXPECT(test::throws(
[&] { migraphx::parse_onnx("einsum_empty_term_before_arrow_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_empty_term_before_arrow_negative_test.onnx"); }));
}

TEST_CASE(einsum_multiple_ellipses_negative_test)
{
EXPECT(
test::throws([&] { migraphx::parse_onnx("einsum_multiple_ellipses_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_multiple_ellipses_negative_test.onnx"); }));
}

TEST_CASE(einsum_comma_in_output_negative_test)
{
EXPECT(
test::throws([&] { migraphx::parse_onnx("einsum_comma_in_output_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_comma_in_output_negative_test.onnx"); }));
}

TEST_CASE(einsum_empty_term_before_comma_negative_test)
{
EXPECT(test::throws(
[&] { migraphx::parse_onnx("einsum_empty_term_before_comma_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_empty_term_before_comma_negative_test.onnx"); }));
}

TEST_CASE(einsum_last_input_missing_negative_test)
{
EXPECT(test::throws(
[&] { migraphx::parse_onnx("einsum_last_input_missing_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_last_input_missing_negative_test.onnx"); }));
}

TEST_CASE(einsum_term_input_mismatch_negative_test)
{
EXPECT(test::throws(
[&] { migraphx::parse_onnx("einsum_term_input_mismatch_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_term_input_mismatch_negative_test.onnx"); }));
}

TEST_CASE(einsum_ellipsis_mismatch_negative_test)
{
EXPECT(
test::throws([&] { migraphx::parse_onnx("einsum_ellipsis_mismatch_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_ellipsis_mismatch_negative_test.onnx"); }));
}

TEST_CASE(einsum_rank_mismatch_negative_test)
{
EXPECT(test::throws([&] { migraphx::parse_onnx("einsum_rank_mismatch_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_rank_mismatch_negative_test.onnx"); }));
}

TEST_CASE(einsum_output_surplus_label_negative_test)
{
EXPECT(test::throws(
[&] { migraphx::parse_onnx("einsum_output_surplus_label_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_output_surplus_label_negative_test.onnx"); }));
}

TEST_CASE(einsum_output_missing_ellipsis_negative_test)
{
EXPECT(test::throws(
[&] { migraphx::parse_onnx("einsum_output_missing_ellipsis_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_output_missing_ellipsis_negative_test.onnx"); }));
}

TEST_CASE(einsum_multiple_diagonals_negative_test)
{
EXPECT(test::throws(
[&] { migraphx::parse_onnx("einsum_multiple_diagonals_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_multiple_diagonals_negative_test.onnx"); }));
}

TEST_CASE(einsum_diagonal_dim_mismatch_negative_test)
{
EXPECT(test::throws(
[&] { migraphx::parse_onnx("einsum_diagonal_dim_mismatch_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_diagonal_dim_mismatch_negative_test.onnx"); }));
}

TEST_CASE(einsum_right_batch_diagonal_negative_test)
{
EXPECT(test::throws(
[&] { migraphx::parse_onnx("einsum_right_batch_diagonal_negative_test.onnx"); }));
EXPECT(test::throws([&] { read_onnx("einsum_right_batch_diagonal_negative_test.onnx"); }));
}
Loading

0 comments on commit 2542894

Please sign in to comment.