Skip to content

Commit

Permalink
update the example codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
wzzju committed Aug 21, 2020
1 parent c846c10 commit 5c2936e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python/paddle/fluid/dygraph/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,20 +437,20 @@ def test_dygraph_grad(grad_outputs=None):
return dx.numpy()
THREE = paddle.fill_constant(shape=[1], value=3.0, dtype='float32')
FOUR = paddle.fill_constant(shape=[1], value=4.0, dtype='float32')
grad_value = paddle.fill_constant(shape=[1], value=4.0, dtype='float32')
# dy1 = [1], dy2 = [1]
print(test_dygraph_grad(None)) # [7.]
# dy1 = [1], dy2 = [4]
print(test_dygraph_grad([None, FOUR])) # [16.]
print(test_dygraph_grad([None, grad_value])) # [16.]
# dy1 = [4], dy2 = [1]
print(test_dygraph_grad([FOUR, None])) # [19.]
print(test_dygraph_grad([grad_value, None])) # [19.]
# dy1 = [3], dy2 = [4]
print(test_dygraph_grad([THREE, FOUR])) # [24.]
grad_y1 = paddle.fill_constant(shape=[1], value=3.0, dtype='float32')
print(test_dygraph_grad([grad_y1, grad_value])) # [24.]
'''

def check_in_out(in_out_list, name):
Expand Down

0 comments on commit 5c2936e

Please sign in to comment.