提交 f2e6ef0e 编写于 作者: Z zenghsh3

yapf

上级 1e2746fa
...@@ -14,12 +14,14 @@ ...@@ -14,12 +14,14 @@
from paddle import fluid from paddle import fluid
def net(obs, act_dim): def net(obs, act_dim):
hid1_size = act_dim * 10 hid1_size = act_dim * 10
hid1 = fluid.layers.fc(obs, size=hid1_size) hid1 = fluid.layers.fc(obs, size=hid1_size)
prob = fluid.layers.fc(hid1, size=act_dim, act='softmax') prob = fluid.layers.fc(hid1, size=act_dim, act='softmax')
return prob return prob
if __name__ == '__main__': if __name__ == '__main__':
obs_dim = 4 obs_dim = 4
act_dim = 2 act_dim = 2
...@@ -30,7 +32,8 @@ if __name__ == '__main__': ...@@ -30,7 +32,8 @@ if __name__ == '__main__':
exe = fluid.Executor(fluid.CPUPlace()) exe = fluid.Executor(fluid.CPUPlace())
exe.run(fluid.default_startup_program()) exe.run(fluid.default_startup_program())
fluid.io.save_inference_model(dirname='cartpole_init_model', fluid.io.save_inference_model(
feeded_var_names=['obs'], dirname='cartpole_init_model',
target_vars=[prob], feeded_var_names=['obs'],
executor=exe) target_vars=[prob],
executor=exe)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册