Create a tensor in cpu is OK, but create it in GPU(that`s mean use .to(at::Kcuda) ) will cause an error.
When i debug this program, i found this error locates at a function: const KernelFunction& lookup(DispatchKey k) const (line 176 in OperatorEntry.h)
and its parameter value is NULL?
Detail Value can be obtained from the following :
k "CUDA(2'\x')
kernel {functor_={target_=0x0000000000000000 <NULL> } boxed_kernel_func_=0x0000000000000000 unboxed_kernel_func_=...} const c10::KernelFunction &
this 0x0000000001f372a0 {name_={name="aten::empty_strided" overload_name="" } schema_={...} dispatchTable_=...} c10::impl::OperatorEntry *
The function code:
const KernelFunction& lookup(DispatchKey k) const {
const auto idx = getDispatchTableIndexForDispatchKey(k);
if (C10_UNLIKELY(idx == -1)) {
reportError(k);
}
const auto& kernel = dispatchTable_[idx];
// A valid kernel *always* has a boxed kernel and *may* have an
// unboxed kernel. However, we typically do unboxed calls in at::
// APIs, where the kernel 1) will very likely be valid and 2)
// should have an unboxed kernel. Checking the unboxed kernel
// first will allow us to avoid touching the boxed kernel at all
// in the common case.
if (C10_UNLIKELY(!kernel.isValidUnboxed())) {
if (!kernel.isValid()) {
reportError(k);
}
}
return kernel;
}