Skip to content

Commit 3280d09

Browse files
authored
Update gradients_cn.rst
1 parent 826cfed commit 3280d09

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

docs/api/paddle/static/gradients_cn.rst

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,4 @@ list[Tensor],包含与输入对应的梯度。如果一个输入不影响目
2828
代码示例
2929
::::::::::::
3030

31-
.. code-block:: python
32-
33-
import paddle
34-
import paddle.nn.functional as F
35-
36-
paddle.enable_static()
37-
38-
x = paddle.static.data(name='x', shape=[None, 2, 8, 8], dtype='float32')
39-
x.stop_gradient=False
40-
y = paddle.static.nn.conv2d(x, 4, 1, bias_attr=False)
41-
y = F.relu(y)
42-
z = paddle.static.gradients([y], x)
43-
print(z)
44-
# [var x@GRAD : LOD_TENSOR.shape(-1, 2, 8, 8).dtype(float32).stop_gradient(False)]
31+
COPY-FROM: <paddle.static.gradients>:<code-example>

0 commit comments

Comments
 (0)