Skip to content

Commit 4c8c5b4

Browse files
authored
Modify English Doc of ControlFlow APIs for Scalar Tensor (#49890)
Modify English Doc of ControlFlow APIs for Scalar Tensor Corresponding Chinese Doc PR: PaddlePaddle/docs#5588
1 parent 5ffc22d commit 4c8c5b4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

python/paddle/static/nn/control_flow.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def case(pred_fn_pairs, default=None, name=None):
569569
This operator works like an if-elif-elif-else chain.
570570
571571
Args:
572-
pred_fn_pairs(list|tuple): A list or tuple of (pred, fn) pairs. ``pred`` is a boolean Tensor with shape [1], ``fn`` is a callable. All callables return the same structure of Tensors.
572+
pred_fn_pairs(list|tuple): A list or tuple of (pred, fn) pairs. ``pred`` is a boolean Tensor whose numel should be 1 (shape [] or shape [1]), ``fn`` is a callable. All callables return the same structure of Tensors.
573573
default(callable, optional): Callable that returns a structure of Tensors.
574574
name(str, optional): The default value is None. Normally there is no need for user to set this property. For more information, please refer to :ref:`api_guide_Name`.
575575
@@ -702,7 +702,7 @@ def switch_case(branch_index, branch_fns, default=None, name=None):
702702
This operator is like a C++ switch/case statement.
703703
704704
Args:
705-
branch_index(Tensor): A Tensor with shape [1] to specify which branch to execute. The data type is ``int32``, ``int64`` or ``uint8``.
705+
branch_index(Tensor): A Tensor whose numel should be 1 (shape [] or shape [1]) to specify which branch to execute. The data type is ``int32``, ``int64`` or ``uint8``.
706706
branch_fns(dict|list|tuple): If it's a list or tuple, the elements in it could be pairs of (int, callable) or simple callables whose actual index will be used as the index of callable. If it's a dict, its key is a python integer and the value is a callable. All callables return the same structure of Tensors.
707707
default(callable, optional): Callable that returns a structure of Tensors.
708708
name(str, optional): The default value is None. Normally there is no need for user to set this property. For more information, please refer to :ref:`api_guide_Name`.
@@ -910,9 +910,9 @@ def cond(pred, true_fn=None, false_fn=None, name=None, return_names=None):
910910
branch will be executed during runtime.
911911
912912
Args:
913-
pred(Tensor): A boolean tensor whose numel should be 1. The boolean
914-
value determines whether to return the result of ``true_fn`` or
915-
``false_fn`` .
913+
pred(Tensor): A boolean tensor whose numel should be 1 (shape []
914+
or shape [1]). The boolean value determines whether to return the
915+
result of ``true_fn`` or ``false_fn`` .
916916
true_fn(callable, optional): A callable to be performed if ``pred`` is
917917
true. The default value is ``None`` .
918918
false_fn(callable, optional): A callable to be performed if ``pred`` is

0 commit comments

Comments
 (0)