(self)
| 57 | return self.shape[1:] |
| 58 | |
| 59 | def validate(self): |
| 60 | if self.name in {"R", "G", "B"}: |
| 61 | if len(self.shape) != 2: |
| 62 | raise ValueError( |
| 63 | f"expecting exactly 2-D shape for '{self.name}' but got: {self.shape}" |
| 64 | ) |
| 65 | elif self.name == "arr_0": |
| 66 | if len(self.shape) < 2: |
| 67 | raise ValueError(f"expecting at least 2-D shape but got: {self.shape}") |
| 68 | elif len(self.shape) == 3: |
| 69 | # For audio, we require continuous samples. |
| 70 | if not np.issubdtype(self.dtype, np.floating): |
| 71 | raise ValueError( |
| 72 | f"invalid dtype for audio batch: {self.dtype} (expected float)" |
| 73 | ) |
| 74 | elif self.dtype != np.uint8: |
| 75 | raise ValueError(f"invalid dtype for image batch: {self.dtype} (expected uint8)") |
| 76 | |
| 77 | |
| 78 | class NpzStreamer: |
nothing calls this directly
no outgoing calls
no test coverage detected