(data)
| 28 | |
| 29 | |
| 30 | def _get_shape(data): |
| 31 | if hasattr(data, "shape"): |
| 32 | return data.shape() if callable(data.shape) else data.shape |
| 33 | elif hasattr(data, "__array_interface__"): |
| 34 | return data.__array_interface__["shape"] |
| 35 | elif hasattr(data, "__cuda_array_interface__"): |
| 36 | return data.__cuda_array_interface__["shape"] |
| 37 | else: |
| 38 | raise RuntimeError(f"Don't know how to extract the shape out of {type(data)}") |
| 39 | |
| 40 | |
| 41 | def _get_batch_shape(data): |
no test coverage detected