Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tmva/sofie/inc/TMVA/ROperator_Tanh.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ public:
std::stringstream out;
size_t length = ConvertShapeToLength(fShape);
out << "\n//------ TANH\n";
out << SP << "for (int id = 0; id < " << length << " ; id++){\n";
out << SP << SP << "tensor_" << fNY << "[id] = std::tanh(tensor_" << fNX << "[id]);\n";
out << SP << "for (size_t id = 0; id < " << length << " ; id++){\n";
out << SP << SP << "auto x = tensor_" << fNX << "[id];\n";
out << SP << SP << "auto exp2x = std::exp(2.0f * x);\n";
out << SP << SP << "tensor_" << fNY << "[id] = (exp2x - 1.0f) / (exp2x + 1.0f);\n";
out << SP << "}\n";
return out.str();
}
Expand Down