From bea4c6fd65ac88a52130cd0398f1afea46578c04 Mon Sep 17 00:00:00 2001 From: Andreas Bloch Date: Thu, 4 Jul 2019 23:56:53 +0200 Subject: [PATCH] Fix math error lim for x->0 of sinh(x)/x = 1 (and not 0). --- pytorch/hyperbolic_parameter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch/hyperbolic_parameter.py b/pytorch/hyperbolic_parameter.py index e19a2a9e..41224377 100644 --- a/pytorch/hyperbolic_parameter.py +++ b/pytorch/hyperbolic_parameter.py @@ -122,7 +122,7 @@ def exp(self, lr): cosh = torch.cosh(n) cosh[mask] = 1.0 sinh = torch.sinh(n) - sinh[mask] = 0.0 + sinh[mask] = 1.0 n[mask] = 1.0 e = cosh*x + sinh/n*v # assert torch.all(-HyperboloidParameter.dot_h(e,e) >= 0), torch.min(-HyperboloidParameter.dot_h(e,e))