Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/torch7.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsoumith <soumith@fb.com>2017-04-12 03:59:30 +0300
committersoumith <soumith@fb.com>2017-04-12 03:59:42 +0300
commitbc5ae21def2d2b20c4ddb929ae128fd6153eb35d (patch)
tree61db23b8d1b99fda44c9cb759f39e5b4a23020c2
parenta9174b52f2975e5766d3ff9a6f111a2cffa40054 (diff)
addr zeroes output buffer when beta=0
-rw-r--r--lib/TH/generic/THTensorMath.c5
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)