paddlepaddle学习笔记(1)x+y

一、代码说明

layers是一个计算单元,其输入和输出都是variable

fetch_list获取输入数据

将一个Program()放到Executor中执行运算 

from paddle import fluid
x = fluid.layers.fill_constant(shape=[1],dtype='int64',value=5)
y = fluid.layers.fill_constant(shape=[1],dtype='int64',value=1)
z = x+y
exe = fluid.Executor(fluid.CPUPlace())
exe.run(fluid.default_main_program(),fetch_list=[z])

二、执行结果:

猜你喜欢

转载自blog.csdn.net/Johnisjohn/article/details/89706145