提交 512c03a9 编写于 作者: J jiangjiajun

update ndarray writting method

上级 c68db84c
......@@ -179,18 +179,7 @@ class PaddleEmitter(object):
desc_size = tensor_desc.ByteSize()
filew.write(struct.pack('i', desc_size))
filew.write(tensor_desc.SerializeToString())
if len(shape) == 0:
if weight.size == 1:
tensor_size = 1
weight = numpy.array([weight])
else:
tensor_size = 0
else:
tensor_size = reduce(lambda x, y: x * y, shape)
weight = weight.flatten()
for i in range(0, tensor_size):
filew.write(
struct.pack(struct_write_format[str(weight.dtype)], weight[i]))
weight.tofile(filew)
filew.close()
@property
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册