Convert to an int32 or int64 tensor, defaulting to int64 if empty.
(shape)
| 152 | |
| 153 | |
| 154 | def _shape_tensor(shape): |
| 155 | """Convert to an int32 or int64 tensor, defaulting to int64 if empty.""" |
| 156 | if isinstance(shape, (tuple, list)) and not shape: |
| 157 | dtype = dtypes.int64 |
| 158 | else: |
| 159 | dtype = None |
| 160 | return ops.convert_to_tensor(shape, dtype=dtype, name="shape") |
| 161 | |
| 162 | |
| 163 | def _convert_to_state_tensor(t): |
no outgoing calls
no test coverage detected