commit | 8f62f9b87aacb787e505308f373a8fa444e6fe8a | [log] [tgz] |
---|---|---|
author | Scott Todd <scotttodd@google.com> | Thu Aug 24 13:31:53 2023 -0700 |
committer | GitHub <noreply@github.com> | Thu Aug 24 20:31:53 2023 +0000 |
tree | 00841c5d0106c9a17d71021096b99c88ca446882 | |
parent | 308637a1b8b48c9004787828a7776f6ad5c62587 [diff] |
Fix ir_tool argparse subcommand usage. (#14804) The "cp" alias for "copy" was not working, instead producing an error: `error: Unrecognized sub-command {args.sub_command}"`. The docs (https://docs.python.org/3/library/argparse.html#sub-commands) recommend using ```python parser = argparse.ArgumentParser() subparsers = parser.add_subparsers(required=True) parser_foo = subparsers.add_parser('foo') parser_foo.set_defaults(func=foo) # parse the args and call whatever function was selected args = parser.parse_args(...) args.func(args) ``` After switching to that style, "cp" and "copy" both work. If an unknown subcommand is used, argparse has its own error message: ```bash $ python -m iree.compiler.tools.ir_tool foo usage: __main__.py [-h] {copy,cp,strip-data} ... __main__.py: error: argument sub_command: invalid choice: 'foo' (choose from 'copy', 'cp', 'strip-data') ``` (and the program returns exit code `2`, not `0`)
IREE (Intermediate Representation Execution Environment, pronounced as “eerie”) is an MLIR-based end-to-end compiler and runtime that lowers Machine Learning (ML) models to a unified IR that scales up to meet the needs of the datacenter and down to satisfy the constraints and special considerations of mobile and edge deployments.
See our website for project details, user guides, and instructions on building from source.
IREE is still in its early phase. We have settled down on the overarching infrastructure and are actively improving various software components as well as project logistics. It is still quite far from ready for everyday use and is made available without any support at the moment. With that said, we welcome any kind of feedback on any communication channels!
See our website for more information.
IREE is licensed under the terms of the Apache 2.0 License with LLVM Exceptions. See LICENSE for more information.