Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions tmva/sofie/inc/TMVA/ROperator_BasicBinary.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ template <typename T>
struct BinaryOperatorTrait<T, Mod> {
static const std::string Name() { return "Mod"; }
static std::string Op(const std::string & t1, const std::string t2) { return "(" + t1 + " % " + t2 + ")"; }
static T Func (T t1, T t2) { return std::pow(t1,t2);}
static T Func(T t1, T t2) { return t1 % t2; }
};
template <typename T>
struct BinaryOperatorTrait<T, FMod> {
static const std::string Name() { return "FMod"; }
static std::string Op(const std::string & t1, const std::string t2) { return "std::fmod(" + t1 + "," + t2 + ")"; }
static T Func (T t1, T t2) { return std::pow(t1,t2);}
static T Func(T t1, T t2) { return std::fmod(t1, t2); }
};

template <typename T, EBasicBinaryOperator Op>
Expand Down
11 changes: 11 additions & 0 deletions tmva/sofie/test/TestCustomModelsFromONNX.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,17 @@ TEST(ONNX, Pow_broadcast){

}

TEST(ONNX, FMod_ConstantFolding)
{
// Both inputs are Constant nodes, so SOFIE constant-folds via Func().
// fmod([10, 7, 5], [3, 3, 3]) = [1, 1, 2]
std::vector<float> correct_output = {1, 1, 2};
ASSERT_INCLUDE_AND_RUN_0(std::vector<float>, "FMod_ConstantFolding");
EXPECT_EQ(output.size(), correct_output.size());
for (size_t i = 0; i < output.size(); ++i)
EXPECT_LE(std::abs(output[i] - correct_output[i]), DEFAULT_TOLERANCE);
}

TEST(ONNX, ReduceMean){
constexpr float TOLERANCE = DEFAULT_TOLERANCE;

Expand Down
Binary file not shown.