提交 c0e687b9 编写于 作者: Y Yu Yang

Refine Code

上级 8a42a549
import py_paddle.swig_paddle as api
from paddle.trainer.config_parser import parse_config
def main():
api.initPaddle("-use_gpu=false", "-trainer_count=4") # use 4 cpu cores
config = parse_config('simple_mnist_network.py', '')
m = api.GradientMachine.createFromConfigProto(config.model_config)
if __name__ == '__main__':
main()
from paddle.trainer_config_helpers import *
settings(learning_rate=1e-4, learning_method=AdamOptimizer(), batch_size=1000)
imgs = data_layer(name='pixel', size=784)
hidden1 = fc_layer(input=imgs, size=200)
hidden2 = fc_layer(input=hidden1, size=200)
inference = fc_layer(input=hidden2, size=10, act=SoftmaxActivation())
cost = classification_cost(
input=inference, label=data_layer(
name='label', size=10))
outputs(cost)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册