From abccb16248212f33f23d985d5d1087789ea8999d Mon Sep 17 00:00:00 2001 From: li-xl <1905692338@qq.com> Date: Thu, 29 Jul 2021 21:47:41 +0800 Subject: [PATCH 1/2] polish xavier_uniform --- python/jittor/init.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/jittor/init.py b/python/jittor/init.py index e44b47f8..22480d86 100644 --- a/python/jittor/init.py +++ b/python/jittor/init.py @@ -100,7 +100,6 @@ def kaiming_normal_(var, a=0, mode='fan_in', nonlinearity='leaky_relu'): return gauss_(var,0, std) -#TODO: bound = gain * math.sqrt(6.0/fan) ?? def xavier_uniform(shape, dtype, gain=1.0): assert len(shape)>1 @@ -108,7 +107,7 @@ def xavier_uniform(shape, dtype, gain=1.0): for i in shape[2:]: matsize *= i fan = (shape[1] * matsize) + (shape[0] * matsize) - bound = gain * math.sqrt(1.0/fan) + bound = gain * math.sqrt(6.0/fan) return uniform(shape, dtype, -bound, bound) def xavier_uniform_(var, gain=1.0): From 43b150a6c846cea28e4e4cdb204cf6b7c9e2c865 Mon Sep 17 00:00:00 2001 From: Zheng-Ning Liu Date: Fri, 30 Jul 2021 15:52:52 +0800 Subject: [PATCH 2/2] Update auto_diff.py fixed: symbol not found when running "from jittor_utils import auto_diff; import jittor as jt" --- python/jittor_utils/auto_diff.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/jittor_utils/auto_diff.py b/python/jittor_utils/auto_diff.py index 0bb60353..1235ca31 100644 --- a/python/jittor_utils/auto_diff.py +++ b/python/jittor_utils/auto_diff.py @@ -7,8 +7,8 @@ import jittor_utils from jittor_utils import LOG import sys -jittor_utils.try_import_jit_utils_core() - +with jittor_utils.import_scope(os.RTLD_GLOBAL | os.RTLD_NOW): + jittor_utils.try_import_jit_utils_core() has_error = 0