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

Failed to cast np.int to int #6186

Closed
gcesars opened this issue Sep 28, 2022 · 1 comment · Fixed by #6211
Closed

Failed to cast np.int to int #6186

gcesars opened this issue Sep 28, 2022 · 1 comment · Fixed by #6211
Assignees
Labels
potential bug Something that looks like a bug but not yet confirmed

Comments

@gcesars
Copy link

gcesars commented Sep 28, 2022

Describe the bug
When you try to create a pointer block with the argument of the type np.int, it raises an exception. If you simply cast it with int() it works, but it is not easy to diagnose.

To Reproduce

import taichi as ti
import numpy as np

ti.init(arch=ti.gpu)

np_int = np.max([0, 1, 2])
block = ti.root.pointer(ti.i, np_int)

Log/Screenshots

[Taichi] version 1.1.3, llvm 10.0.0, commit 1262a70a, osx, python 3.10.6
[Taichi] Starting on arch=metal
Traceback (most recent call last):
  File "/test.py", line 7, in <module>
    block = ti.root.pointer(ti.i, np_int)
  File "/miniconda3/envs/env/lib/python3.10/site-packages/taichi/_snode/fields_builder.py", line 79, in pointer
    return self.root.pointer(indices, dimensions)
  File "//miniconda3/envs/end/lib/python3.10/site-packages/taichi/lang/snode.py", line 52, in pointer
    self.ptr.pointer(axes, dimensions,
TypeError: pointer(): incompatible function arguments. The following argument types are supported:
    1. (self: taichi._lib.core.taichi_python.SNode, arg0: List[taichi._lib.core.taichi_python.Axis], arg1: List[int], arg2: bool) -> taichi._lib.core.taichi_python.SNode


@gcesars gcesars added the potential bug Something that looks like a bug but not yet confirmed label Sep 28, 2022
@taichi-gardener taichi-gardener moved this to Untriaged in Taichi Lang Sep 28, 2022
@erizmr erizmr moved this from Untriaged to Todo in Taichi Lang Sep 30, 2022
@strongoier
Copy link
Contributor

Thanks for reporting this! This is indeed a bug and I've submitted #6211 to fix it.

Repository owner moved this from Todo to Done in Taichi Lang Oct 8, 2022
strongoier added a commit that referenced this issue Oct 8, 2022
Issue: fix #6186

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
potential bug Something that looks like a bug but not yet confirmed
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants