An addition:
In the call stack there is an exception in checked_tensor_unwrap.
“”"
if (tensorTypeIdToBackend(expr.type_id()) != backend) {
AT_ERROR(“Expected object of backend “, backend, " but got backend “, tensorTypeIdToBackend(expr.type_id()),
" for argument #”, pos, " '”, name, “’”);
“””
the backend is CPU(0) the pos = 2 and the name = ‘weight’ the expr.typeid = 4