提交 c1843fd2 编写于 作者: X Xin Pan

improve

上级 9185579c
...@@ -1219,20 +1219,21 @@ class IfElse(object): ...@@ -1219,20 +1219,21 @@ class IfElse(object):
Examples: Examples:
.. code-block:: python .. code-block:: python
limit = layers.fill_constant_batch_size_like( limit = fluid.layers.fill_constant_batch_size_like(
input=label, dtype='int64', shape=[1], value=5.0) input=label, dtype='int64', shape=[1], value=5.0)
cond = layers.less_than(x=label, y=limit) cond = fluid.layers.less_than(x=label, y=limit)
ie = layers.IfElse(cond) ie = fluid.layers.IfElse(cond)
with ie.true_block(): with ie.true_block():
true_image = ie.input(image) true_image = ie.input(image)
hidden = layers.fc(input=true_image, size=100, act='tanh') hidden = fluid.layers.fc(input=true_image, size=100, act='tanh')
prob = layers.fc(input=hidden, size=10, act='softmax') prob = fluid.layers.fc(input=hidden, size=10, act='softmax')
ie.output(prob) ie.output(prob)
with ie.false_block(): with ie.false_block():
false_image = ie.input(image) false_image = ie.input(image)
hidden = layers.fc(input=false_image, size=200, act='tanh') hidden = fluid.layers.fc(
prob = layers.fc(input=hidden, size=10, act='softmax') input=false_image, size=200, act='tanh')
prob = fluid.layers.fc(input=hidden, size=10, act='softmax')
ie.output(prob) ie.output(prob)
prob = ie() prob = ie()
""" """
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册