Unverified Commit 1f741f73 authored by Paul Fultz II's avatar Paul Fultz II Committed by GitHub
Browse files

Add a command to the driver to list supported onnx operators (#938)

* Add a command to list supported onnx operators
parent 33a17257
...@@ -503,6 +503,26 @@ struct op : command<op> ...@@ -503,6 +503,26 @@ struct op : command<op>
} }
}; };
struct onnx : command<onnx>
{
bool show_ops = false;
void parse(argument_parser& ap)
{
ap(show_ops,
{"--list", "-l"},
ap.help("List all onnx operators supported by MIGraphX"),
ap.set_value(true));
}
void run() const
{
if(show_ops)
{
for(const auto& name : get_onnx_operators())
std::cout << name << std::endl;
}
}
};
struct main_command struct main_command
{ {
static std::string get_command_help() static std::string get_command_help()
......
...@@ -29,6 +29,8 @@ program parse_onnx_buffer(const std::string& buffer, const onnx_options& options ...@@ -29,6 +29,8 @@ program parse_onnx_buffer(const std::string& buffer, const onnx_options& options
/// Create a program from an onnx buffer /// Create a program from an onnx buffer
program parse_onnx_buffer(const void* data, std::size_t size, const onnx_options& options); program parse_onnx_buffer(const void* data, std::size_t size, const onnx_options& options);
std::vector<std::string> get_onnx_operators();
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx } // namespace migraphx
......
#include <migraphx/onnx/onnx_parser.hpp> #include <migraphx/onnx/onnx_parser.hpp>
#include <migraphx/onnx/op_parser.hpp>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <unordered_map> #include <unordered_map>
...@@ -57,5 +58,7 @@ program parse_onnx_buffer(const void* data, std::size_t size, const onnx_options ...@@ -57,5 +58,7 @@ program parse_onnx_buffer(const void* data, std::size_t size, const onnx_options
return parse_onnx_from(options, data, size); return parse_onnx_from(options, data, size);
} }
std::vector<std::string> get_onnx_operators() { return onnx::get_op_parsers(); }
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx } // namespace migraphx
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment