Add a correctness check for C++ types to custom operators (#15247)
authorPeter Goldsborough <psag@fb.com>
Tue, 18 Dec 2018 00:07:14 +0000 (16:07 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 18 Dec 2018 00:17:27 +0000 (16:17 -0800)
commit2f38ffbcb300fa75bd97ec70a446540bcba4ee7c
tree6c1eac0b09eb41ceef44648a660d357e822160b7
parente650a848721a39707dcdde3e36a5ca05f3da0510
Add a correctness check for C++ types to custom operators (#15247)

Summary:
The JIT uses `int64_t` for its integer type and `double` for its floating point type, but users quite often want to write `int` or `float` and that currently fails in not-so-nice ways for custom ops. This PR adds a simple `static_assert` to catch these common failure cases.

zdevito
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15247

Differential Revision: D13493941

Pulled By: goldsborough

fbshipit-source-id: c1cd0d10ab5838c75f167c0bdb57e45a0bc1344e
torch/csrc/jit/custom_operator.h