(self)
| 40 | |
| 41 | @property |
| 42 | def batch_size(self) -> int: |
| 43 | for tensor in self.as_dict().values(): |
| 44 | if tensor is None: |
| 45 | continue |
| 46 | if not isinstance(tensor, torch.Tensor): |
| 47 | continue |
| 48 | return tensor.shape[0] |
| 49 | raise Exception("Could not determine batch size from tensors.") |
| 50 | |
| 51 | |
| 52 | @dataclass |