diff options
author | Soumith Chintala <soumith@gmail.com> | 2017-03-22 18:53:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-22 18:53:41 +0300 |
commit | 6b6a462d9e0781957f66ab209f051201cdb190de (patch) | |
tree | 5637eab8ed481be90b44574329fbf6347fee1a67 | |
parent | ab320e23301096bfd4863521d191b55b30deeef8 (diff) | |
parent | 724f18b653620836c71209b58c4d019a37e0806b (diff) |
Merge pull request #453 from apaszke/lookup_renorm
Cast accumulator in LookupTable renorm to accreal
-rw-r--r-- | lib/THCUNN/generic/LookupTable.cu | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/THCUNN/generic/LookupTable.cu b/lib/THCUNN/generic/LookupTable.cu index 955b29b..bb30e0a 100644 --- a/lib/THCUNN/generic/LookupTable.cu +++ b/lib/THCUNN/generic/LookupTable.cu @@ -185,7 +185,7 @@ void THNN_(LookupTable_renorm)( THCIndex_t k = idx_ptr[i] - TH_INDEX_BASE; thrust::device_ptr<real> row_ptr = weight_ptr + k * stride; accreal norm = thrust::transform_reduce(row_ptr, row_ptr + stride, - unary_pow, 0, binary_plus); + unary_pow, (accreal)0, binary_plus); norm = std::pow(norm, (accreal) (1.0 / normType)); if (norm > ScalarConvert<real, accreal>::to(maxNorm)) { |