We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a6bb154 commit c79fb30Copy full SHA for c79fb30
aten/src/ATen/native/sparse/cuda/SparseCUDATensor.cu
@@ -143,8 +143,10 @@ SparseTensor coalesce_sparse_cuda(const SparseTensor& self) {
143
}
144
145
////////////////////////////////////////////////////////////
146
-
147
- SparseTensor dst = ::at::native::sparse_coo_tensor(newIndices, newValues, self.sizes())._coalesced_(true);
+ // We can use unsafe sparse tensor constructor because the indices do not
+ // need to be revalidated as we do not add or change indices, just remove
148
+ // duplicates.
149
+ SparseTensor dst = ::at::native::_sparse_coo_tensor_unsafe(newIndices, newValues, self.sizes())._coalesced_(true);
150
151
THCudaCheck(cudaGetLastError());
152
return dst;
0 commit comments