From 44fdc718abe42494ad9e0de3272f5d5235193e60 Mon Sep 17 00:00:00 2001 From: Dun Liang Date: Sun, 4 Dec 2022 18:22:12 +0800 Subject: [PATCH] fix assign var in th_mode --- python/jittor/__init__.py | 2 +- python/jittor/src/var_holder.cc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/python/jittor/__init__.py b/python/jittor/__init__.py index ca4d0b6f..1100ced6 100644 --- a/python/jittor/__init__.py +++ b/python/jittor/__init__.py @@ -9,7 +9,7 @@ # file 'LICENSE.txt', which is part of this source code package. # *************************************************************** -__version__ = '1.3.5.41' +__version__ = '1.3.5.42' from jittor_utils import lock with lock.lock_scope(): ori_int = int diff --git a/python/jittor/src/var_holder.cc b/python/jittor/src/var_holder.cc index dd23970f..25f090cb 100644 --- a/python/jittor/src/var_holder.cc +++ b/python/jittor/src/var_holder.cc @@ -133,6 +133,9 @@ string VarHolder::to_string() { } VarHolder* VarHolder::assign(VarHolder* v) { + if (th_mode) { + v->set_requires_grad(get_requires_grad()); + } assign_var(v->var, var); v->var->own_both_liveness(); var->release_both_liveness();