Paddle1.6.1 load_dygraph接口出core
Created by: sserdoubleh
复现代码:
import paddle
import paddle.fluid as fluid
print(paddle.__version__)
program = fluid.Program()
global_block = program.global_block()
global_block.create_parameter(
name="w",
shape=[10, 10],
dtype="float32",
initializer=fluid.initializer.Constant(value=0.0))
place = fluid.CPUPlace()
exe = fluid.Executor(place)
exe.run(program)
save_dir = "model"
fluid.save(program, save_dir)
with fluid.dygraph.guard(place):
fluid.load_dygraph(save_dir)
print("good")
PaddlePaddle1.6.1 运行结果&报错:
1.6.1
Traceback (most recent call last):
File "test_save_and_load.py", line 32, in <module>
fluid.load_dygraph(save_dir)
File "</home/ol/hehuang/local/python3.7/lib/python3.7/site-packages/decorator.py:decorator-gen-27>", line 2, in load_dygraph
File "/home/ol/hehuang/local/python3.7/lib/python3.7/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
return wrapped_func(*args, **kwargs)
File "/home/ol/hehuang/local/python3.7/lib/python3.7/site-packages/paddle/fluid/framework.py", line 207, in __impl__
return func(*args, **kwargs)
File "/home/ol/hehuang/local/python3.7/lib/python3.7/site-packages/paddle/fluid/dygraph/checkpoint.py", line 112, in load_dygraph
para_dict = core._load_dygraph_dict(params_file_path)
paddle.fluid.core_avx.EnforceNotMet:
--------------------------------------------
C++ Call Stacks (More useful to developers):
--------------------------------------------
0 std::string paddle::platform::GetTraceBackString<std::string const&>(std::string const&, char const*, int)
1 paddle::platform::EnforceNotMet::EnforceNotMet(std::string const&, char const*, int)
2 paddle::framework::ReadTensorNumber(std::istream&)
3 paddle::framework::LoadTensorFromDisk(std::string const&, std::map<std::string, std::shared_ptr<paddle::framework::Tensor>, std::less<std::string>, std::allocator<std::pair<std::string const, std::shared_ptr<paddle::framework::Tensor> > > >*)
4 paddle::framework::LoadDygraphVarBaseListFromDisk(std::string const&)
----------------------
Error Message Summary:
----------------------
PaddleCheckError: Expected tensor_number_mark == str_read_tensor_number_mark, but received tensor_number_mark:TNUM != str_read_tensor_number_mark:
shell returned 1
Paddle1.6.0没有问题:
1.6.0
good