pytorch/torch/csrc/jit/script
Peter Goldsborough cb0e72e00d Add registerOperator overloads that infer the schema (#10048)
Summary:
This PR adds a way to infer the JIT/script schema of a function from its signature, and then create an operator from the schema and implementation. The implementation function is wrapped into another function, which pops values from the stack into an argument tuple, then invokes the function and pushes the return value back onto the stack, sometimes unpacking the return value if it is a tuple.

Currently the method is called `createOperator`. We may want to think of a nicer way of registering ops in tandem with `RegisterOperators`. It might be very cumbersome to add a template constructor to `Operator`, so maybe we can come up with a chaining method on `RegisterOperators` like `RegisterOperators(schema, func).op(schema.func).op(schema, func)` -- it has to work at startup time (for a static variable) though. We can solve this in another PR.

zdevito apaszke smessmer dzhulgakov
Pull Request resolved: https://github.com/pytorch/pytorch/pull/10048

Differential Revision: D9125975

Pulled By: goldsborough

fbshipit-source-id: de9e59888757573284a43787ae5d94384bfe8f9a
2018-08-03 11:45:49 -07:00
..
compiler.cpp Add registerOperator overloads that infer the schema (#10048) 2018-08-03 11:45:49 -07:00
compiler.h Refactor PythonValue types + use tryMatchSchema for PythonOp 2018-08-02 10:26:58 -07:00
error_report.h Allow __constant__ values in a ScriptModule to be used as attributes for builtin functions (#7017) 2018-04-27 17:44:17 -07:00
init.cpp Add g.insertConstant and clean up dead attributes code (#10177) 2018-08-02 20:45:31 -07:00
init.h [jit] Have ScriptModule inherit from Module (#5769) 2018-03-22 00:17:49 -04:00
lexer.cpp Remove TORCH_ASSERT (#9575) 2018-07-24 18:10:06 -07:00
lexer.h Add g.insertConstant and clean up dead attributes code (#10177) 2018-08-02 20:45:31 -07:00
module.cpp Remove TORCH_ASSERT (#9575) 2018-07-24 18:10:06 -07:00
module.h Add registerOperator overloads that infer the schema (#10048) 2018-08-03 11:45:49 -07:00
parser.h Strings lexing, parsing, implementation in print (#9324) 2018-08-02 11:09:03 -07:00
python_tree_views.cpp Strings lexing, parsing, implementation in print (#9324) 2018-08-02 11:09:03 -07:00
python_tree_views.h Add workaround to fix include warnings in Python 2 builds. (#6716) 2018-04-24 12:30:19 -07:00
tree_views.h Strings lexing, parsing, implementation in print (#9324) 2018-08-02 11:09:03 -07:00
tree.h Match parameter names and = default (#9737) 2018-07-30 14:10:00 -07:00