//------------------------------------------------------------ int handle_cuda_notvalid(RESULT& result_1, RESULT& result_2) { //------------------------------------------------------------ int retval=0; bool result_1_is_cuda, result_2_is_cuda; char result_1_cuda_str[16]; char result_2_cuda_str[16]; result_1_is_cuda = is_cuda(result_1); result_2_is_cuda = is_cuda(result_2); if (result_1_is_cuda ^ result_2_is_cuda) { if (result_1_is_cuda) { strcpy(result_1_cuda_str, "cuda"); } else { strcpy(result_1_cuda_str, "noncuda"); } if (result_2_is_cuda) { strcpy(result_2_cuda_str, "cuda"); } else { strcpy(result_2_cuda_str, "noncuda"); } log_messages.printf( SCHED_MSG_LOG::MSG_DEBUG, "[%s RESULT#%d and %s RESULT#%d] do not covalidate\n", result_1_cuda_str, result_1.id, result_2_cuda_str, result_2.id ); // insert additonal "cuda vs noncuda not valid" code here retval = 1; } return(retval); }
Tensor Type::copy(const Tensor & src, bool non_blocking) const { AT_CHECK(src.defined(), "attempt to copy an undefined tensor"); if (is_sparse()) { auto indices = src._indices(); auto values = src._values(); auto & this_dense = toBackend(is_cuda() ? Backend::CUDA : Backend::CPU); auto & this_dense_idx = this_dense.toScalarType(ScalarType::Long); auto indices_copy = this_dense_idx.copy(indices, non_blocking); auto values_copy = this_dense.copy(values, non_blocking); return _sparse_coo_tensor_unsafe(indices_copy, values_copy, src.sizes()); } else { Tensor r = this->tensor(src.sizes()); r.copy_(src, non_blocking); return r; } }