Skip to content

Commit

Permalink
[misc] Add needs_grad property for SNode (#2500)
Browse files Browse the repository at this point in the history
* add needs_grad property

* Auto Format

Co-authored-by: Taichi Gardener <[email protected]>
  • Loading branch information
ljcc0930 and taichi-gardener authored Jul 7, 2021
1 parent 0496b3a commit dedd976
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/taichi/lang/snode.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ def __call__(self): # TODO: remove this after v0.7.0
def snode(self):
return self

@property
def needs_grad(self):
return self.ptr.has_grad()

def get_children(self):
children = []
for i in range(self.ptr.get_num_ch()):
Expand Down

0 comments on commit dedd976

Please sign in to comment.