Skip to content

Commit 4acf063

Browse files
committed
fix clang
1 parent b7e5285 commit 4acf063

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

include/layers/EWLayer.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,16 @@ std::vector<ValueType> EWLayerImpl<ValueType>::run(
9191
} else if (func_ == "sigmoid") {
9292
auto sigmoid = [](ValueType x) -> ValueType {
9393
if constexpr (std::is_integral_v<ValueType>) {
94-
float x_float = static_cast<float>(x);
95-
float result = 1.0f / (1.0f + std::exp(-x_float));
94+
auto x_float = static_cast<float>(x);
95+
float result = 1.0F / (1.0F + std::exp(-x_float));
9696
return static_cast<ValueType>(std::round(result));
9797
} else {
9898
if (x >= ValueType(0)) {
9999
ValueType z = std::exp(-x);
100100
return ValueType(1) / (ValueType(1) + z);
101-
} else {
102-
ValueType z = std::exp(x);
103-
return z / (ValueType(1) + z);
104101
}
102+
ValueType z = std::exp(x);
103+
return z / (ValueType(1) + z);
105104
}
106105
};
107106
std::transform(input.cbegin(), input.cend(), res.begin(), sigmoid);

0 commit comments

Comments
 (0)