Repository: pytorch
Issue: When you try to register a kernel that make boxed from unboxed functor doesn't support you get a horrible error message
Labels: triaged

Here's what you get if you try to register a `aten::resize_` kernel without unboxed only

```
In file included from ../aten/src/ATen/core/boxing/KernelFunction_impl.h:2,                            [218/92024]
                 from ../aten/src/ATen/core/boxing/KernelFunction.h:216,                                                           from ../aten/src/ATen/core/dispatch/DispatchTable.h:9,                                                            from ../aten/src/ATen/core/dispatch/OperatorEntry.h:3,                                           
                 from ../aten/src/ATen/core/dispatch/Dispatcher.h:3,                                                               from aten/src/ATen/core/TensorMethods.h:10,                                                                       from ../aten/src/ATen/Tensor.h:12,                                                                                from ../aten/src/ATen/Context.h:4,                                                               
                 from ../aten/src/ATen/ATen.h:5,                                                                                   from ../aten/src/ATen/native/quantized/cpu/tensor_operators.cpp:1:                               ../aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h: In instantiation of ‘static void c10::impl::m
ake_boxed_from_unboxed_functor<KernelFunctor, AllowDeprecatedTypes, typename std::enable_if<(! std::is_same<void, 
typename c10::guts::infer_function_traits<Functor>::type::return_type>::value), void>::type>::call(c10::OperatorKernel*, const c10::OperatorHandle&, c10::Stack*) [with KernelFunctor = c10::impl::detail::WrapFunctionIntoRuntimeFu
nctor_<at::Tensor& (*)(at::Tensor&, c10::ArrayRef<long int>, c10::optional<c10::MemoryFormat>), at::Tensor&, c10::
guts::typelist::typelist<at::Tensor&, c10::ArrayRef<long int>, c10::optional<c10::MemoryFormat> > >; bool AllowDep
recatedTypes = false; c10::Stack = std::vector<c10::IValue>]’:                                                    ../aten/src/ATen/core/boxing/KernelFunction_impl.h:87:9:   required from ‘static c10::KernelFunction c10::KernelFu
nction::makeFromUnboxedFunctor(std::unique_ptr<c10::OperatorKernel>) [with bool AllowLegacyTypes = false; KernelFu
nctor = c10::impl::detail::WrapFunctionIntoRuntimeFunctor_<at::Tensor& (*)(at::Tensor&, c10::ArrayRef<long int>, c
10::optional<c10::MemoryFormat>), at::Tensor&, c10::guts::typelist::typelist<at::Tensor&, c10::ArrayRef<long int>,
 c10::optional<c10::MemoryFormat> > >]’                                                                           
../aten/src/ATen/core/boxing/KernelFunction_impl.h:138:114:   required from ‘static c10::KernelFunction c10::Kerne
lFunction::makeFromUnboxedRuntimeFunction(FuncType*) [with bool AllowLegacyTypes = false; FuncType = at::Tensor&(a
t::Tensor&, c10::ArrayRef<long int>, c10::optional<c10::MemoryFormat>)]’                                          
../aten/src/ATen/core/op_registration/op_registration.h:655:64:   required from ‘c10::CppFunction::CppFunction(Fun
c*, std::enable_if_t<c10::guts::is_function_type<FuncType>::value, std::nullptr_t>) [with Func = at::Tensor&(at::T
ensor&, c10::ArrayRef<long int>, c10::optional<c10::MemoryFormat>); std::enable_if_t<c10::guts::is_function_type<F
uncType>::value, std::nullptr_t> = std::nullptr_t]’                                                               
../aten/src/ATen/core/op_registration/op_registration.h:886:17:   required from ‘c10::Library& c10::Library::impl(
const char*, Func&&) & [with Func = at::Tensor& (&)(at::Tensor&, c10::ArrayRef<long int>, c10::optional<c10::MemoryFormat>)]’                                                                                                       
../aten/src/ATen/native/quantized/cpu/tensor_operators.cpp:83:42:   required from here                            
../aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:253:115: error: cannot bind non-const lvalue r
eference of type ‘at::Tensor&’ to an rvalue of type ‘std::remove_reference<at::Tensor&>::type’ {aka ‘at::Tensor’} 
       push_outputs<typename guts::infer_function_traits_t<KernelFunctor>::return_type, AllowDeprecatedTypes>::call(std::move(output), stack);                                                                                      
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~^~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                       
../aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:224:17: note:   initializing argument 1 of ‘st
atic void c10::impl::push_outputs<OutputType, AllowDeprecatedTypes>::call(OutputType&&, c10::Stack*) [with OutputT
ype = at::Tensor&; bool AllowDeprecatedTypes = false; c10::Stack = std::vector<c10::IValue>]’                     
     static void call(OutputType&& output, Stack* stack) {                                                        
                 ^~~~                                                                                             
../aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h: In instantiation of ‘static void c10::impl::p
ush_outputs<OutputType, AllowDeprecatedTypes>::call(OutputType&&, c10::Stack*) [with OutputType = at::Tensor&; boo
l AllowDeprecatedTypes = false; c10::Stack = std::vector<c10::IValue>]’:                                          
../aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:253:115:   required from ‘static void c10::imp
l::make_boxed_from_unboxed_functor<KernelFunctor, AllowDeprecatedTypes, typename std::enable_if<(! std::is_same<vo
id, typename c10::guts::infer_function_traits<Functor>::type::return_type>::value), void>::type>::call(c10::Operat
orKernel*, const c10::OperatorHandle&, c10::Stack*) [with KernelFunctor = c10::impl::detail::WrapFunctionIntoRunti
meFunctor_<at::Tensor& (*)(at::Tensor&, c10::ArrayRef<long int>, c10::optional<c10::MemoryFormat>), at::Tensor&, c
10::guts::typelist::typelist<at::Tensor&, c10::ArrayRef<long int>, c10::optional<c10::MemoryFormat> > >; bool Allo
wDeprecatedTypes = false; c10::Stack = std::vector<c10::IValue>]’
```

This issue is probably not quite mooted if we support everything, because there still might be cases where a user will pass in an argument we don't understand.

cc @smessmer