@@ -67,7 +67,7 @@ void THCSTensor_(spaddmm)(THCState *state, THCTensor *r_, real beta, THCTensor *
6767 THArgCheck (THCTensor_ (size)(state, dense, 0 ) == k, 3 ,
6868 " Expected dim 0 size %d, got %d" , k, THCTensor_ (size)(state, dense, 0 ));
6969
70- THCSTensor_ (contiguous )(state, sparse);
70+ THCSTensor_ (coalesce )(state, sparse);
7171
7272 long nnz = THCSTensor_ (nnz)(state, sparse);
7373 indices = THCSTensor_ (newIndices)(state, sparse);
@@ -182,7 +182,7 @@ void THCSTensor_(hspmm)(THCState *state, THCSTensor *r_, real alpha, THCSTensor
182182 long size[2 ] = {m, n};
183183 THCSTensor_ (rawResize)(state, r_, 1 , 1 , size);
184184
185- THCSTensor_ (contiguous )(state, sparse);
185+ THCSTensor_ (coalesce )(state, sparse);
186186
187187 long nnz = THCSTensor_ (nnz)(state, sparse);
188188 THCIndexTensor *indices = THCIndexTensor_ (newWithSize2d)(state, 1 , nnz);
@@ -213,7 +213,7 @@ void THCSTensor_(hspmm)(THCState *state, THCSTensor *r_, real alpha, THCSTensor
213213void THCSTensor_ (spcadd)(THCState *state, THCTensor *r_, THCTensor *dense, real value, THCSTensor *sparse) {
214214 THCAssertSameGPU (THCSTensor_ (checkGPU)(state, 1 , 3 , sparse, r_, dense));
215215 THCTensor_ (resizeAs)(state, r_, dense);
216- THCSTensor_ (contiguous )(state, sparse);
216+ THCSTensor_ (coalesce )(state, sparse);
217217
218218 THCIndexTensor *indices = THCSTensor_ (newIndices)(state, sparse);
219219 THCTensor *values = THCSTensor_ (newValues)(state, sparse);
@@ -274,7 +274,7 @@ void THCSTensor_(mul)(THCState *state, THCSTensor *r_, THCSTensor *t, real value
274274 THCIndexTensor_ (copy)(state, r_indices_, t_indices_);
275275 THCTensor_ (mul)(state, r_values_, t_values_, value);
276276 r_->nnz = t->nnz ;
277- r_->contiguous = t->contiguous ;
277+ r_->coalesced = t->coalesced ;
278278
279279 THCIndexTensor_ (free )(state, r_indices_);
280280 THCTensor_ (free )(state, r_values_);
@@ -300,7 +300,7 @@ void THCSTensor_(div)(THCState *state, THCSTensor *r_, THCSTensor *t, real value
300300 THCIndexTensor_ (copy)(state, r_indices_, t_indices_);
301301 THCTensor_ (div)(state, r_values_, t_values_, value);
302302 r_->nnz = t->nnz ;
303- r_->contiguous = t->contiguous ;
303+ r_->coalesced = t->coalesced ;
304304
305305 THCIndexTensor_ (free )(state, r_indices_);
306306 THCTensor_ (free )(state, r_values_);
@@ -314,8 +314,8 @@ void THCSTensor_(cadd)(THCState *state, THCSTensor *r_, THCSTensor *t, real valu
314314 if (!THCSTensor_ (isSameSizeAs)(state, t, src)) {
315315 THError (" cadd operands have incompatible sizes or dimension types" );
316316 }
317- THCSTensor_ (contiguous )(state, t);
318- THCSTensor_ (contiguous )(state, src);
317+ THCSTensor_ (coalesce )(state, t);
318+ THCSTensor_ (coalesce )(state, src);
319319
320320 if (src->nnz == 0 ) {
321321 THCSTensor_ (copy)(state, r_, t);
@@ -328,7 +328,7 @@ void THCSTensor_(cadd)(THCState *state, THCSTensor *r_, THCSTensor *t, real valu
328328
329329 // We deliberately choose to simply concat the indices and values tensors
330330 // rather than merging them. This removes the need to synchronously fetch nnz
331- // at the end of the operation, at the cost of having a non-contiguous result.
331+ // at the end of the operation, at the cost of having a non-coalesced result.
332332 // This trade-off is preferable for the common use-case of gradient accumulation.
333333 // TODO have two distinct functions? The other option is commented out below
334334 THCIndexTensor *t_indices_ = THCSTensor_ (newIndices)(state, t);
@@ -392,7 +392,7 @@ void THCSTensor_(cadd)(THCState *state, THCSTensor *r_, THCSTensor *t, real valu
392392 // unsigned long nnzOut;
393393 // THCudaCheck(cudaMemcpy(&nnzOut, scratchSpace, sizeof(unsigned long), cudaMemcpyDeviceToHost));
394394 // r_->nnz = nnzOut;
395- // r_->contiguous = 1;
395+ // r_->coalesced = 1;
396396 // if (freeScratchSpace) {
397397 // THCudaCheck(THCudaFree(state, scratchSpace));
398398 // }
@@ -412,8 +412,8 @@ void THCSTensor_(cmul)(THCState *state, THCSTensor *r_, THCSTensor *t, THCSTenso
412412 if (!THCSTensor_ (isSameSizeAs)(state, t, src)) {
413413 THError (" cmul operands have incompatible sizes or dimension types" );
414414 }
415- THCSTensor_ (contiguous )(state, t);
416- THCSTensor_ (contiguous )(state, src);
415+ THCSTensor_ (coalesce )(state, t);
416+ THCSTensor_ (coalesce )(state, src);
417417
418418 if (t->nnz == 0 || src->nnz == 0 ) {
419419 THCSTensor_ (zero)(state, r_);
@@ -455,7 +455,7 @@ void THCSTensor_(cmul)(THCState *state, THCSTensor *r_, THCSTensor *t, THCSTenso
455455 THCudaCheck (cudaGetLastError ());
456456 r_->nnz = THCudaLongStorage_get (state, resultNnz, 0 );
457457 THCudaLongStorage_free (state, resultNnz);
458- r_->contiguous = 1 ;
458+ r_->coalesced = 1 ;
459459
460460 THCIndexTensor_ (free )(state, t_indices_);
461461 THCTensor_ (free )(state, t_values_);
0 commit comments