Creates a `WhileContext`. Args: maximum_iterations: Optional upper bound on number of loop iterations. parallel_iterations: The number of iterations allowed to run in parallel. back_prop: Whether backprop is enabled for this while loop. swap_memory: Whether GPU-CPU memor
(self,
maximum_iterations=None,
parallel_iterations=10,
back_prop=True,
swap_memory=False,
name="while_context",
grad_state=None,
context_def=None,
import_scope=None)
| 1405 | """The context for the loop construct.""" |
| 1406 | |
| 1407 | def __init__(self, |
| 1408 | maximum_iterations=None, |
| 1409 | parallel_iterations=10, |
| 1410 | back_prop=True, |
| 1411 | swap_memory=False, |
| 1412 | name="while_context", |
| 1413 | grad_state=None, |
| 1414 | context_def=None, |
| 1415 | import_scope=None): |
| 1416 | """"Creates a `WhileContext`. |
| 1417 | |
| 1418 | Args: |
| 1419 | maximum_iterations: Optional upper bound on number of loop iterations. |
| 1420 | parallel_iterations: The number of iterations allowed to run in parallel. |
| 1421 | back_prop: Whether backprop is enabled for this while loop. |
| 1422 | swap_memory: Whether GPU-CPU memory swap is enabled for this loop. |
| 1423 | name: Optional name prefix for the returned tensors. |
| 1424 | grad_state: The gradient loop state. |
| 1425 | context_def: Optional `WhileContextDef` protocol buffer to initialize the |
| 1426 | `Whilecontext` python object from. |
| 1427 | import_scope: Optional `string`. Name scope to add. Only used when |
| 1428 | initialing from protocol buffer. |
| 1429 | """ |
| 1430 | if context_def: |
| 1431 | self._init_from_proto(context_def, import_scope=import_scope) |
| 1432 | else: |
| 1433 | ControlFlowContext.__init__(self) |
| 1434 | self._init_from_args(maximum_iterations, parallel_iterations, back_prop, |
| 1435 | swap_memory, name) |
| 1436 | # The gradient loop state. |
| 1437 | self._grad_state = grad_state |
| 1438 | |
| 1439 | def _init_from_args(self, maximum_iterations, parallel_iterations, back_prop, |
| 1440 | swap_memory, name): |
nothing calls this directly
no test coverage detected