From 87ee69498507ca6b731a1b66de59c1eff164e9a9 Mon Sep 17 00:00:00 2001 From: qiaolongfei Date: Mon, 4 Sep 2017 09:07:42 -0700 Subject: [PATCH] complete the demo code --- doc/design/var_desc.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/design/var_desc.md b/doc/design/var_desc.md index 5286f0a4824..3dc25c23c03 100644 --- a/doc/design/var_desc.md +++ b/doc/design/var_desc.md @@ -50,7 +50,7 @@ message LoDTensorDesc { In Python API, layer will take Variable as Input, and return Variable as Output. ```python -image = Variable() +image = Variable(dims=[-1, 640, 480]) # fc1 and fc2 are both Variable fc1 = layer.fc(input=image, output_size=10) fc2 = layer.fc(input=fc1, output_size=20) @@ -90,14 +90,14 @@ def flatten_size(X, num_flatten_dims): return prod def layer.fc(X, output_size, num_flatten_dims): - W = Var(type=FP32, dims=[flatten_size(X, num_flatten_dims), output_size]) + W = Variable(type=FP32, dims=[flatten_size(X, num_flatten_dims), output_size]) b = Variable(type=FP32, dims=[output_size]) out = Variable(type=FP32) y = operator.fc(X, W, b, output=out) # fc will put fc op input into out pd.InferShape(y) return out -x = var(dim=[-1, 640, 480]) +x = Variable(dims=[-1, 640, 480]) y = layer.fc(x, output_size=100) z = layer.fc(y, output_size=200) -- GitLab