You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
when instaciating a taichi.Struct.field with shape and offset, taichi raise an exception error "shape cannot be None when offset is set"
$ python .\sanboxxx.py
[Taichi] version 1.7.1, llvm 15.0.1, commit 0f143b2f, win, python 3.10.9
[Taichi] Starting on arch=x64
Traceback (most recent call last):
File "C:\Users\MEEEE\Documents\M2_stage\internship-virgile-taichi\sanboxxx.py", line 4, in <module>
struct_field = ti.Struct.field(
File "C:\Users\MEEEE\Documents\M2_stage\internship-virgile-taichi\env\lib\site-packages\taichi\lang\util.py", line 334, in wrapped
return func(*args, **kwargs)
File "C:\Users\MEEEE\Documents\M2_stage\internship-virgile-taichi\env\lib\site-packages\taichi\lang\struct.py", line 305, in field
field_dict[key] = impl.field(
File "C:\Users\MEEEE\Documents\M2_stage\internship-virgile-taichi\env\lib\site-packages\taichi\lang\util.py", line 334, in wrapped
return func(*args, **kwargs)
File "C:\Users\MEEEE\Documents\M2_stage\internship-virgile-taichi\env\lib\site-packages\taichi\lang\impl.py", line 814, in field
return _field(dtype, *args, **kwargs)
File "C:\Users\MEEEE\Documents\M2_stage\internship-virgile-taichi\env\lib\site-packages\taichi\lang\util.py", line 334, in wrapped
return func(*args, **kwargs)
File "C:\Users\MEEEE\Documents\M2_stage\internship-virgile-taichi\env\lib\site-packages\taichi\lang\impl.py", line 733, in _field
raise TaichiSyntaxError("shape cannot be None when offset is set")
taichi.lang.exception.TaichiSyntaxError: shape cannot be None when offset is set
Additional comments
A simple fix seems to set the offset to None in the field classmethod of Struct :
class Struct:
#...
def field(
#...
):
#...
for key, dtype in members.items():
#...
field_dict[key] = dtype.field(
shape=None,
name=field_name,
offset=offset, ## <-- offset=None seems to make it work
needs_grad=needs_grad,
needs_dual=needs_dual,
)
#...
#....
The text was updated successfully, but these errors were encountered:
Describe the bug
when instaciating a taichi.Struct.field with shape and offset, taichi raise an exception error "shape cannot be None when offset is set"
To Reproduce
Log/Screenshots
Additional comments
A simple fix seems to set the offset to None in the
field
classmethod of Struct :The text was updated successfully, but these errors were encountered: