File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 6
6
#include " TMVA/RModel.hxx"
7
7
8
8
#include < sstream>
9
+ #include < vector>
10
+ #include < string>
9
11
10
12
namespace TMVA {
11
13
namespace Experimental {
@@ -57,8 +59,10 @@ public:
57
59
std::stringstream out;
58
60
size_t length = ConvertShapeToLength (fShape );
59
61
out << " \n //------ TANH\n " ;
60
- out << SP << " for (int id = 0; id < " << length << " ; id++){\n " ;
61
- out << SP << SP << " tensor_" << fNY << " [id] = std::tanh(tensor_" << fNX << " [id]);\n " ;
62
+ out << SP << " for (size_t id = 0; id < " << length << " ; id++){\n " ;
63
+ out << SP << SP << " auto x = tensor_" << fNX << " [id];\n " ;
64
+ out << SP << SP << " auto exp2x = std::exp(2.0f * x);\n " ;
65
+ out << SP << SP << " tensor_" << fNY << " [id] = (exp2x - 1.0f) / (exp2x + 1.0f);\n " ;
62
66
out << SP << " }\n " ;
63
67
return out.str ();
64
68
}
You can’t perform that action at this time.
0 commit comments