提交 ca747f65 编写于 作者: S SunAhong1993

remove warning

上级 d6fa03f4
...@@ -46,7 +46,7 @@ def is_valid(sample): ...@@ -46,7 +46,7 @@ def is_valid(sample):
return False return False
elif isinstance(s, np.ndarray) and s.size == 0: elif isinstance(s, np.ndarray) and s.size == 0:
return False return False
elif isinstance(s, collections.Sequence) and len(s) == 0: elif isinstance(s, collections.abc.Sequence) and len(s) == 0:
return False return False
return True return True
......
...@@ -53,14 +53,14 @@ def get_environ_info(): ...@@ -53,14 +53,14 @@ def get_environ_info():
def parse_param_file(param_file, return_shape=True): def parse_param_file(param_file, return_shape=True):
from paddle.fluid.proto.framework_pb2 import VarType from paddle.fluid.proto.framework_pb2 import VarType
f = open(param_file, 'rb') f = open(param_file, 'rb')
version = np.fromstring(f.read(4), dtype='int32') version = np.frombuffer(f.read(4), dtype='int32')
lod_level = np.fromstring(f.read(8), dtype='int64') lod_level = np.frombuffer(f.read(8), dtype='int64')
for i in range(int(lod_level)): for i in range(int(lod_level)):
_size = np.fromstring(f.read(8), dtype='int64') _size = np.frombuffer(f.read(8), dtype='int64')
_ = f.read(_size) _ = f.read(_size)
version = np.fromstring(f.read(4), dtype='int32') version = np.frombuffer(f.read(4), dtype='int32')
tensor_desc = VarType.TensorDesc() tensor_desc = VarType.TensorDesc()
tensor_desc_size = np.fromstring(f.read(4), dtype='int32') tensor_desc_size = np.frombuffer(f.read(4), dtype='int32')
tensor_desc.ParseFromString(f.read(int(tensor_desc_size))) tensor_desc.ParseFromString(f.read(int(tensor_desc_size)))
tensor_shape = tuple(tensor_desc.dims) tensor_shape = tuple(tensor_desc.dims)
if return_shape: if return_shape:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册