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

[Refactor] Avoid exposing real and integer types API #4129

Merged
merged 4 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions python/taichi/lang/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@
from taichi.snode.fields_builder import FieldsBuilder
from taichi.tools.util import set_gdb_trigger, warning
from taichi.types.annotations import any_arr, ext_arr, template
from taichi.types.primitive_types import (f16, f32, f64, i32, i64,
integer_types, u32, u64)
from taichi.types.primitive_types import f16, f32, f64, i32, i64, u32, u64

from taichi import _logging

Expand Down
6 changes: 4 additions & 2 deletions python/taichi/lang/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from taichi.lang.matrix import Matrix
from taichi.lang.util import (cook_dtype, in_python_scope, is_taichi_class,
python_scope, taichi_scope)
from taichi.types import CompoundType, integer_types
from taichi.types import CompoundType, primitive_types


class Struct(TaichiOperations):
Expand Down Expand Up @@ -494,7 +494,9 @@ def cast(self, struct):
else:
if in_python_scope():
v = struct.entries[k]
entries[k] = int(v) if dtype in integer_types else float(v)
entries[k] = int(
v
) if dtype in primitive_types.integer_types else float(v)
else:
entries[k] = ops.cast(struct.entries[k], dtype)
return Struct(entries)
Expand Down
2 changes: 0 additions & 2 deletions python/taichi/types/primitive_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@
'u32',
'uint64',
'u64',
'real_types',
'integer_types',
'is_signed',
'is_integral',
]