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

The code snippet about ti.Vector is not working #501

Open
cooperliu101 opened this issue Sep 13, 2022 · 6 comments
Open

The code snippet about ti.Vector is not working #501

cooperliu101 opened this issue Sep 13, 2022 · 6 comments
Assignees

Comments

@cooperliu101
Copy link

cooperliu101 commented Sep 13, 2022

I find that the below code is not working. the taichi version is 1.1.2. The code is placed at field.md

f = ti.Vector(ti.f32, n=2).field(shape=(1,2,3))

Is this the old syntax?

@writinwaters
Copy link
Contributor

@neozhaoliang Please could you take a look?

@neozhaoliang
Copy link
Contributor

@cooperliu101 The function ti.Vector requires an input array, it does not support the syntax ti.Vector(dtype, n).

@cooperliu101
Copy link
Author

The code is placed at field.md
we should fix the doc

@neozhaoliang
Copy link
Contributor

@cooperliu101 Could please add the link to that line?

@cooperliu101
Copy link
Author

The 1.1.3 version doc have replaced with new code contents.

The below link is the old version.
https://github.com/taichi-dev/docs.taichi.graphics/blob/master/website/versioned_docs/version-v1.1.2/lang/articles/basic/field.md#declaration-1

@neozhaoliang
Copy link
Contributor

neozhaoliang commented Sep 25, 2022

Thanks. The line below in the link is wrong and we have fixed it in v1.1.3:

# Declare a 1x2x3 vector field whose vector dimension is n=2
f = ti.Vector(ti.f32, n=2).field(shape=(1,2,3))

The correct syntax isti.Vector.field, not ti.Vector().field().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants