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

[Lang] Make tensor indicing automatically cast to int32 and raise an warning #1453

Merged

Conversation

archibate
Copy link
Collaborator

Related issue = close #1360

[Click here for the format server]


IIUC the index to tensor should always be int32 no matter what default_ip is?

@archibate archibate force-pushed the indicing-automatically-cast-into-int32 branch from c5adefe to 513dd52 Compare July 10, 2020 15:13
stmt->name(), stmt->ptr->ret_data_type_name(),
old_data->ret_data_type_name(), stmt->id);
fmt::print(stmt->tb);
TI_WARN("\n{}", stmt->tb);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I change them as OFT, so that users don't see them when log_level is 'error'.

@codecov

This comment has been minimized.

Copy link
Contributor

@xumingkuan xumingkuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!


func()

assert a[6, 3] == 233
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it guaranteed that int32(6.66) == 6 on all platforms?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's how a Python int does, and I believe backends should follow that too.

@archibate archibate added the LGTM label Jul 11, 2020
@archibate archibate requested a review from k-ye July 11, 2020 13:05
@archibate archibate merged commit 315c3fc into taichi-dev:master Jul 12, 2020
@FantasyVR FantasyVR mentioned this pull request Jul 15, 2020
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

Successfully merging this pull request may close these issues.

[Lang] Make tensor indicing automatically cast to int32
3 participants