Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy_from() crashes for fields of struct types #7290

Closed
AmesingFlank opened this issue Feb 3, 2023 · 0 comments · Fixed by #7294
Closed

copy_from() crashes for fields of struct types #7290

AmesingFlank opened this issue Feb 3, 2023 · 0 comments · Fixed by #7294
Assignees

Comments

@AmesingFlank
Copy link
Collaborator

The following code crashes

@ti.dataclass
class C:
    i: int
    f: float

cf1 = C.field(shape = (2,))
cf2 = C.field(shape = (2,))

cf1.copy_from(cf2)

with the error message

TypeError: Cannot copy from a non-field object

Interestingly, if the copy is performed on 2D fields, the crash has a different error message:

@ti.dataclass
class C:
    i: int
    f: float

cf1 = C.field(shape = (2,2))
cf2 = C.field(shape = (2,2))

cf1.copy_from(cf2)
AssertionError: Slicing is not supported on ti.field
@github-project-automation github-project-automation bot moved this to Untriaged in Taichi Lang Feb 3, 2023
@lin-hitonami lin-hitonami moved this from Untriaged to Todo in Taichi Lang Feb 3, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Taichi Lang Feb 6, 2023
strongoier added a commit that referenced this issue Feb 6, 2023
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants