未验证 提交 73342c67 编写于 作者: C Chen Long 提交者: GitHub

Fix example code bugs (#42739)

* update readme test=document_fix

* fix api docs bugs test=document_fix
上级 9029fde7
...@@ -219,8 +219,14 @@ def remove_weight_norm(layer, name='weight'): ...@@ -219,8 +219,14 @@ def remove_weight_norm(layer, name='weight'):
conv = Conv2D(3, 5, 3) conv = Conv2D(3, 5, 3)
wn = weight_norm(conv) wn = weight_norm(conv)
remove_weight_norm(conv)
print(conv.weight_g) print(conv.weight_g)
# Parameter containing:
# Tensor(shape=[5], dtype=float32, place=Place(gpu:0), stop_gradient=False,
# [0., 0., 0., 0., 0.])
# Conv2D(3, 5, kernel_size=[3, 3], data_format=NCHW)
remove_weight_norm(conv)
# print(conv.weight_g)
# AttributeError: 'Conv2D' object has no attribute 'weight_g' # AttributeError: 'Conv2D' object has no attribute 'weight_g'
""" """
for k, hook in layer._forward_pre_hooks.items(): for k, hook in layer._forward_pre_hooks.items():
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册