Allow ops without tensor args if only fallback kernel exists (#19284)
authorSebastian Messmer <messmer@fb.com>
Thu, 18 Apr 2019 09:00:49 +0000 (02:00 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 18 Apr 2019 09:04:40 +0000 (02:04 -0700)
commit12dcc77bcb1233aa805858862618e595e49ff3ec
tree417a706280f03a80884d8619db9faf22646463c7
parent8036af39d2f0718e019d68616f279015d72688a8
Allow ops without tensor args if only fallback kernel exists (#19284)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19284

Instantiating a dispatch table previously only worked when the op had a tensor argument we could dispatch on.
However, the legacy API for custom operators didn't have dispatch and also worked for operators without tensor arguments, so we need to continue supporting that.
It probably generally makes sense to support this as long as there's only a fallback kernel and no dispatched kernel registered.
This diff adds that functionality.

Reviewed By: dzhulgakov

Differential Revision: D14931926

fbshipit-source-id: 38fadcba07e5577a7329466313c89842d50424f9
aten/src/ATen/core/dispatch/DispatchTable.h
aten/src/ATen/core/op_registration/kernel_function_legacy_test.cpp
aten/src/ATen/core/op_registration/kernel_function_test.cpp
aten/src/ATen/core/op_registration/kernel_functor.h
aten/src/ATen/core/op_registration/kernel_functor_test.cpp
aten/src/ATen/core/op_registration/kernel_lambda_legacy_test.cpp
aten/src/ATen/core/op_registration/kernel_lambda_test.cpp
aten/src/ATen/core/op_registration/kernel_stackbased_test.cpp
aten/src/ATen/core/op_registration/op_registration_test.cpp