fix assign var in th_mode

This commit is contained in:
Dun Liang 2022-12-04 18:22:12 +08:00
parent 87489d719e
commit 44fdc718ab
2 changed files with 4 additions and 1 deletions

View File

@ -9,7 +9,7 @@
# file 'LICENSE.txt', which is part of this source code package. # 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 from jittor_utils import lock
with lock.lock_scope(): with lock.lock_scope():
ori_int = int ori_int = int

View File

@ -133,6 +133,9 @@ string VarHolder::to_string() {
} }
VarHolder* VarHolder::assign(VarHolder* v) { VarHolder* VarHolder::assign(VarHolder* v) {
if (th_mode) {
v->set_requires_grad(get_requires_grad());
}
assign_var(v->var, var); assign_var(v->var, var);
v->var->own_both_liveness(); v->var->own_both_liveness();
var->release_both_liveness(); var->release_both_liveness();