未验证 提交 6f8de31d 编写于 作者: W WeiXin 提交者: GitHub

fix test_paddle_save_load and test_paddle_save_load_binary (#32949)

* fix test_paddle_save_load and test_paddle_save_load_binary

* fix unittest:test_paddle_save_load and test_paddle_save_load_binary

* delete *.pyc

* add comment for unittest
上级 7896b51a
......@@ -412,8 +412,7 @@ class TestSaveLoadAny(unittest.TestCase):
]
obj2 = {'k1': obj1, 'k2': state_dict, 'epoch': 123}
obj3 = (paddle.randn(
[5, 4], dtype='float32'), np.ndarray(
[3, 4], dtype="float32"), {
[5, 4], dtype='float32'), np.random.randn(3, 4).astype("float32"), {
"state_dict": state_dict,
"opt": state_dict
})
......
......@@ -19,6 +19,7 @@ import numpy as np
import os
import sys
import six
import platform
import paddle
import paddle.nn as nn
......@@ -162,7 +163,8 @@ class TestSaveLoadBinaryFormat(unittest.TestCase):
with self.assertRaises(NotImplementedError):
path = 'test_save_load_error/temp'
paddle.save({}, path, use_binary_format=True)
# On the Windows platform, when parsing a string that can't be parsed as a `Program`, `desc_.ParseFromString` has a timeout risk.
if 'Windows' != platform.system():
with self.assertRaises(ValueError):
path = 'test_save_load_error/temp'
with open(path, "w") as f:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册