Skip to content

Commit

Permalink
addr zeroes output buffer when beta=0
Browse files Browse the repository at this point in the history
  • Loading branch information
soumith committed Apr 12, 2017
1 parent 662163b commit 0925c91
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion generic/THTensorMath.c
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,10 @@ void THTensor_(addr)(THTensor *r_, real beta, THTensor *t, real alpha, THTensor
THTensor_(copy)(r_, t);
}

if(beta != 1)
if(beta == 0) {
THTensor_(zero)(r_);
}
else if(beta != 1)
THTensor_(mul)(r_, r_, beta);

if(r_->stride[0] == 1)
Expand Down

0 comments on commit 0925c91

Please sign in to comment.