diff options
author | soumith <soumith@fb.com> | 2017-04-12 03:59:30 +0300 |
---|---|---|
committer | soumith <soumith@fb.com> | 2017-04-12 03:59:42 +0300 |
commit | bc5ae21def2d2b20c4ddb929ae128fd6153eb35d (patch) | |
tree | 61db23b8d1b99fda44c9cb759f39e5b4a23020c2 | |
parent | a9174b52f2975e5766d3ff9a6f111a2cffa40054 (diff) |
addr zeroes output buffer when beta=0
-rw-r--r-- | lib/TH/generic/THTensorMath.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/TH/generic/THTensorMath.c b/lib/TH/generic/THTensorMath.c index 83488d3..ec0c856 100644 --- a/lib/TH/generic/THTensorMath.c +++ b/lib/TH/generic/THTensorMath.c @@ -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) |