Skip to content

Commit

Permalink
[lang] Hide dtype and needs_grad from SNode (#4308)
Browse files Browse the repository at this point in the history
  • Loading branch information
strongoier authored Feb 17, 2022
1 parent 063d630 commit be74dbd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion python/taichi/lang/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def dtype(self):
Returns:
DataType: Data type of each individual value.
"""
return self.snode.dtype
return self.snode._dtype

@property
def name(self):
Expand Down
2 changes: 1 addition & 1 deletion python/taichi/lang/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ def calc_dynamic_index_stride(self):
length = len(paths[0])
if any(
len(path) != length or ti_core.is_custom_type(path[length -
1].dtype)
1]._dtype)
for path in paths):
return
for i in range(length):
Expand Down
11 changes: 1 addition & 10 deletions python/taichi/lang/snode.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def _path_from_root(self):
return res

@property
def dtype(self):
def _dtype(self):
"""Gets the data type of `self`.
Returns:
Expand Down Expand Up @@ -255,15 +255,6 @@ def snode(self):
"""
return self

@property
def needs_grad(self):
"""Checks whether `self` has a corresponding gradient :class:`~taichi.lang.SNode`.
Returns:
bool: Whether `self` has a corresponding gradient :class:`~taichi.lang.SNode`.
"""
return self.ptr.has_grad()

def _get_children(self):
"""Gets all children components of `self`.
Expand Down

0 comments on commit be74dbd

Please sign in to comment.