Validate `keep_input` argument to conditional batching functions.
(keep_input, enqueue_many)
| 643 | |
| 644 | |
| 645 | def _validate_keep_input(keep_input, enqueue_many): |
| 646 | """Validate `keep_input` argument to conditional batching functions.""" |
| 647 | keep_input = ops.convert_to_tensor(keep_input) |
| 648 | if keep_input.shape.ndims is None: |
| 649 | raise ValueError( |
| 650 | "`keep_input` dimensions must be known at graph construction.") |
| 651 | if not enqueue_many and keep_input.shape.ndims == 1: |
| 652 | raise ValueError( |
| 653 | "`keep_input` cannot be a vector when `enqueue_many=False`.") |
| 654 | if keep_input.shape.ndims > 1: |
| 655 | raise ValueError("`keep_input` must be 0 or 1 dimensions.") |
| 656 | return keep_input |
| 657 | |
| 658 | |
| 659 | def _dtypes(tensor_list_list): |
no outgoing calls
no test coverage detected