Skip to content

Commit ece0a3d

Browse files
Add unit test for get_onnx_operators()
1 parent 7767c0d commit ece0a3d

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

src/api/include/migraphx/migraphx.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ inline std::vector<std::string> get_onnx_operators()
16141614
{
16151615
char* name_op;
16161616
call(&migraphx_get_onnx_operator_name_at_index, &name_op, index);
1617-
name = *name_op;
1617+
name = name_op;
16181618
index++;
16191619
}
16201620
return result;

test/api/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ add_api_test(op test_op_construct.cpp ${TEST_ONNX_DIR})
6565
add_c_api_test(c_op test_c_op_construct.c ${TEST_ONNX_DIR})
6666
add_api_test(custom_op test_custom_op.cpp ${TEST_ONNX_DIR})
6767
add_api_test(tf_parser test_tf_parser.cpp ${TEST_TF_DIR})
68+
add_api_test(onnx_op_list test_onnx_op_list.cpp ${TEST_ONNX_DIR})
6869
# GPU-based tests
6970
if(MIGRAPHX_ENABLE_GPU)
7071
add_api_test(gpu test_gpu.cpp ${TEST_ONNX_DIR})

test/api/test_onnx_op_list.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
#include <migraphx/migraphx.h>
25+
#include <migraphx/migraphx.hpp>
26+
#include "test.hpp"
27+
28+
TEST_CASE(list_onnx_operators)
29+
{
30+
auto list = migraphx::get_onnx_operators();
31+
for(auto &name: list)
32+
std::cout << name << std::endl;
33+
34+
EXPECT(true);
35+
}
36+
37+
int main(int argc, const char* argv[]) { test::run(argc, argv); }

0 commit comments

Comments
 (0)