Skip to content

Commit

Permalink
Merge pull request torch#269 from dominikgrewe/maskedCopyFix
Browse files Browse the repository at this point in the history
Fix loop logic error in maskedCopy.
  • Loading branch information
soumith committed Jun 26, 2015
2 parents 38bbb02 + 986ef6f commit 12ec0ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/TH/generic/THTensorMath.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ void THTensor_(maskedCopy)(THTensor *tensor, THByteTensor *mask, THTensor* src )
}
else if (*mask_data == 1)
{
if (cntr == nelem)
THError("Number of elements of src < number of ones in mask");
*tensor_data = *src_data;
src_data++;
cntr++;
if (cntr > nelem)
THError("Number of elements of src < number of ones in mask");
});
THTensor_(free)(srct);
}
Expand Down

0 comments on commit 12ec0ad

Please sign in to comment.