提交 62abba19 编写于 作者: H hjchen2

Replace std::expf with expf since expf is not a std function for ubuntu os

上级 04a7abda
...@@ -34,7 +34,7 @@ void SequenceSoftmax(const framework::LoDTensor *X, framework::LoDTensor *Y) { ...@@ -34,7 +34,7 @@ void SequenceSoftmax(const framework::LoDTensor *X, framework::LoDTensor *Y) {
} }
float sum = 0.f; float sum = 0.f;
for (int j = 0; j < num_classes; ++j) { for (int j = 0; j < num_classes; ++j) {
float tmp = std::expf(input[j] - max); float tmp = expf(input[j] - max);
sum += tmp; sum += tmp;
output[j] = tmp; output[j] = tmp;
} }
......
...@@ -38,7 +38,7 @@ void Softmax(const framework::Tensor *X, framework::Tensor *Y) { ...@@ -38,7 +38,7 @@ void Softmax(const framework::Tensor *X, framework::Tensor *Y) {
} }
float sum = 0.f; float sum = 0.f;
for (int j = 0; j < num_classes; ++j) { for (int j = 0; j < num_classes; ++j) {
float tmp = std::expf(input[j] - max); float tmp = expf(input[j] - max);
sum += tmp; sum += tmp;
output[j] = tmp; output[j] = tmp;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册