diff options
author | lichen <lichenarthurdata@gmail.com> | 2017-09-10 11:33:07 +0300 |
---|---|---|
committer | Soumith Chintala <soumith@gmail.com> | 2017-09-11 20:31:04 +0300 |
commit | fbcabfa0cd8ca83589f88079bc1821ec4ce2051f (patch) | |
tree | 652dd19a384eebb8a7070d152ae197b7ae6086dd | |
parent | f73bb16bc8e7f2d17d09a149fa00b05eada822d7 (diff) |
simplify the code
-rw-r--r-- | lib/TH/generic/THTensorMath.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/TH/generic/THTensorMath.c b/lib/TH/generic/THTensorMath.c index 1ed4ee2..1e62bae 100644 --- a/lib/TH/generic/THTensorMath.c +++ b/lib/TH/generic/THTensorMath.c @@ -3201,10 +3201,7 @@ void THTensor_(linspace)(THTensor *r_, real a, real b, long n) } if(n == 1) { - TH_TENSOR_APPLY(real, r_, - *r__data = a; - i++; - ); + THTensor_(set1d)(r_, 0, a); } else { TH_TENSOR_APPLY(real, r_, *r__data = a + i*(b-a)/((real)(n-1)); @@ -3224,10 +3221,7 @@ void THTensor_(logspace)(THTensor *r_, real a, real b, long n) } if(n == 1) { - TH_TENSOR_APPLY(real, r_, - *r__data = TH_MATH_NAME(pow)(10.0, a); - i++; - ); + THTensor_(set1d)(r_, 0, TH_MATH_NAME(pow)(10.0, a)); } else { TH_TENSOR_APPLY(real, r_, *r__data = TH_MATH_NAME(pow)(10.0, a + i*(b-a)/((real)(n-1))); |