mirror of https://github.com/Jittor/Jittor
setitem polish
This commit is contained in:
parent
db30ead79e
commit
d31cdab30f
|
@ -7,7 +7,7 @@
|
|||
# This file is subject to the terms and conditions defined in
|
||||
# file 'LICENSE.txt', which is part of this source code package.
|
||||
# ***************************************************************
|
||||
__version__ = '1.2.0.4'
|
||||
__version__ = '1.2.0.5'
|
||||
from . import lock
|
||||
with lock.lock_scope():
|
||||
from . import compiler
|
||||
|
|
|
@ -188,7 +188,7 @@ def setitem(x, slices, value):
|
|||
if isinstance(slices, jt.Var) and slices.dtype == "bool":
|
||||
mask = jt.broadcast(slices, x)
|
||||
value = jt.broadcast(value, x)
|
||||
return mask.ternary(value, mask)
|
||||
return x.assign(mask.ternary(value, mask))
|
||||
if isinstance(slices, list):
|
||||
slices = tuple(slices)
|
||||
return x.assign(x.setitem(slices, value))
|
||||
|
|
Loading…
Reference in New Issue