From 537a0d4c0e22dae88b7c917928bda2f976cb6700 Mon Sep 17 00:00:00 2001 From: Coke Date: Fri, 15 Dec 2017 13:47:11 +0800 Subject: [PATCH] Update infer.py --- doc/getstarted/concepts/src/infer.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/getstarted/concepts/src/infer.py b/doc/getstarted/concepts/src/infer.py index 780d831da83..4cc58dfee0b 100644 --- a/doc/getstarted/concepts/src/infer.py +++ b/doc/getstarted/concepts/src/infer.py @@ -6,9 +6,13 @@ x = paddle.layer.data(name='x', type=paddle.data_type.dense_vector(2)) y_predict = paddle.layer.fc(input=x, size=1, act=paddle.activation.Linear()) # loading the model which generated by training -with open('hello_params_pass_90.tar', 'r') as f: +with open('params_pass_90.tar', 'r') as f: parameters = paddle.parameters.Parameters.from_tar(f) -i = [[[1, 2]]] - +# Input multiple sets of dataļ¼ŒOutput the infer result in a array. +i = [[[1, 2]], [[3, 4]], [[5, 6]]] print paddle.infer(output_layer=y_predict, parameters=parameters, input=i) +# Will print: +# [[ -3.24491572] +# [ -6.94668722] +# [-10.64845848]] -- GitLab