Exits the current frame to its parent frame. Exit makes its input `data` available to the parent frame. Args: data: The tensor to be made available to the parent frame. name: A name for this operation (optional). Returns: The same tensor as `data`.
(data, name=None)
| 260 | |
| 261 | |
| 262 | def exit(data, name=None): # pylint: disable=redefined-builtin |
| 263 | """Exits the current frame to its parent frame. |
| 264 | |
| 265 | Exit makes its input `data` available to the parent frame. |
| 266 | |
| 267 | Args: |
| 268 | data: The tensor to be made available to the parent frame. |
| 269 | name: A name for this operation (optional). |
| 270 | |
| 271 | Returns: |
| 272 | The same tensor as `data`. |
| 273 | """ |
| 274 | data = ops.internal_convert_to_tensor_or_composite(data, as_ref=True) |
| 275 | if isinstance(data, ops.Tensor): |
| 276 | if data.dtype._is_ref_dtype: # pylint: disable=protected-access |
| 277 | return gen_control_flow_ops.ref_exit(data, name) |
| 278 | else: |
| 279 | return gen_control_flow_ops._exit(data, name) |
| 280 | elif isinstance(data, composite_tensor.CompositeTensor): |
| 281 | return nest.map_structure(exit, data, expand_composites=True) |
| 282 | else: |
| 283 | raise TypeError("Type %s not supported" % type(data)) |
| 284 | |
| 285 | |
| 286 | def switch(data, pred, dtype=None, name=None): |