未验证 提交 c3b7bc61 编写于 作者: L Liyulingyue 提交者: GitHub

fix docs of auto_cast, cuda_places, static.save (#42107)

* auto_cast; test=document_fix

* static.save; test=document_fix

* cuda_places; test=document_fix
上级 766c50ac
......@@ -54,25 +54,25 @@ def auto_cast(enable=True,
with paddle.amp.auto_cast():
conv = conv2d(data)
print(conv.dtype) # FP16
print(conv.dtype) # paddle.float32
with paddle.amp.auto_cast(enable=False):
conv = conv2d(data)
print(conv.dtype) # FP32
print(conv.dtype) # paddle.float32
with paddle.amp.auto_cast(custom_black_list={'conv2d'}):
conv = conv2d(data)
print(conv.dtype) # FP32
print(conv.dtype) # paddle.float32
a = paddle.rand([2,3])
b = paddle.rand([2,3])
with paddle.amp.auto_cast(custom_white_list={'elementwise_add'}):
c = a + b
print(c.dtype) # FP16
print(c.dtype) # paddle.float32
with paddle.amp.auto_cast(custom_white_list={'elementwise_add'}, level='O2'):
d = a + b
print(d.dtype) # FP16
print(d.dtype) # paddle.float32
"""
return amp_guard(enable, custom_white_list, custom_black_list, level, dtype)
......
......@@ -1846,8 +1846,7 @@ def _legacy_save(param_dict, model_path, protocol=2):
@static_only
def save(program, model_path, protocol=4, **configs):
"""
:api_attr: Static Graph
This function save parameters, optimizer information and network description to model_path.
The parameters contains all the trainable Tensor, will save to a file with suffix ".pdparams".
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册