Returns the inner shape for a python list `item`.
(item)
| 278 | """Computes a default inner shape for the given python list.""" |
| 279 | |
| 280 | def get_inner_shape(item): |
| 281 | """Returns the inner shape for a python list `item`.""" |
| 282 | if not isinstance(item, (list, tuple)) and np.ndim(item) == 0: |
| 283 | return () |
| 284 | elif item: |
| 285 | return (len(item),) + get_inner_shape(item[0]) |
| 286 | return (0,) |
| 287 | |
| 288 | def check_inner_shape(item, shape): |
| 289 | """Checks that `item` has a consistent shape matching `shape`.""" |
no test coverage detected