| `for` | Nested for loops are partially supported. Iteration sequences must be tuples or lists.
| `for` | Nested for loops are partially supported. Iteration sequences must be tuples or lists.
| `while` | Nested while loops are partially supported. Grad of net with while is not supported.
| `while` | Nested while loops are partially supported. Grad of net with while is not supported.
| `break` | Same as that in Python.
| `if` | Same as that in Python. The input of the `if` condition must be a constant.
| `if` | Same as that in Python. The input of the `if` condition must be a constant.
| `def` | Same as that in Python.
| `in` | Only supports judging whether constants exist in Tuple/List/Dictionary whose elements are all constants.
| `in` | Only support Dictionary.
| `not in` | Only support Dictionary.
| `not in` | Only support Dictionary.
| Assignment statement | Accessed multiple subscripts of lists and dictionaries cannot be used as l-value.
| Assignment statement | Accessed multiple subscripts of lists and dictionaries cannot be used as l-value.
### System Functions
### System Functions/Class
* len
* partial
| Functions/Class | Compared with Python
* map
| :----------- |:--------
* zip
| `len` | The usage principle is consistent with Python, and the returned result is consistent with Python, returning int.
* range
| `partial` | The usage principle is consistent with Python, and the returned result is inconsistent with Python, returning function.
| `map` | The usage principle is consistent with Python, and the returned result is inconsistent with Python, returning tuple.
| `zip` | The usage principle is consistent with Python, and the returned result is inconsistent with Python, returning tuple.
| `range` | The usage principle is consistent with Python, and the returned result is inconsistent with Python, returning tuple.
| `enumerate` | The usage principle is consistent with Python, and the returned result is inconsistent with Python, returning tuple.
| `super` | The usage principle is consistent with Python, and the returned result is inconsistent with Python, returning the namespace defined by mindspore.
| `isinstance` | The usage principle is consistent with Python, but the second input parameter can only be the type defined by mindspore.
### Function Parameters
### Function Parameters
* Default parameter value: The data types `int`, `float`, `bool`, `None`, `str`, `tuple`, `list`, and `dict` are supported, whereas `Tensor` is not supported.
* Default parameter value: The data types `int`, `float`, `bool`, `None`, `str`, `tuple`, `list`, and `dict` are supported, whereas `Tensor` is not supported.
...
@@ -172,7 +179,7 @@ Currently, the following syntax is not supported in network constructors:
...
@@ -172,7 +179,7 @@ Currently, the following syntax is not supported in network constructors:
### Other Constraints
### Other Constraints
Input parameters of the construct function on the entire network and parameters of functions modified by the ms_function decorator are generalized during the graph compilation. Therefore, they cannot be transferred to operators as constant input, as shown in the following example:
Input parameters of the construct function on the entire network and parameters of functions modified by the ms_function decorator are generalized during the graph compilation. Therefore, they cannot be transferred to operators as constant input. Therefore, in graph mode, the parameter passed to the entry network can only be Tensor. As shown in the following example: