From 052d14b1a4a3683bd1e90081603f52ffc668fb4d Mon Sep 17 00:00:00 2001 From: mcDandy Date: Sun, 1 Mar 2026 16:10:51 +0100 Subject: [PATCH] Keep type --- more_math/Parser/UnifiedMathVisitor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/more_math/Parser/UnifiedMathVisitor.py b/more_math/Parser/UnifiedMathVisitor.py index 551445c..a3bba44 100644 --- a/more_math/Parser/UnifiedMathVisitor.py +++ b/more_math/Parser/UnifiedMathVisitor.py @@ -3384,7 +3384,7 @@ class UnifiedMathVisitor(MathExprVisitor): # Shannon entropy: -sum(p * log(p)) p = F.softmax(val.flatten().float(), dim=0) entropy = -torch.sum(p * torch.log(p + 1e-10)) - return float(entropy.item()) + return entropy.item() def visitCorrFunc(self, ctx): x = self._promote_to_tensor((yield ctx.expr(0))).float() @@ -3393,6 +3393,6 @@ class UnifiedMathVisitor(MathExprVisitor): vx = x - torch.mean(x) vy = y - torch.mean(y) corr = torch.sum(vx * vy) / (torch.sqrt(torch.sum(vx ** 2)) * torch.sqrt(torch.sum(vy ** 2))) - return float(corr.item()) + return corr.item()