slice the camera in the b dimension. Always retain (b, q, 4, 4) even when ib is int.
(self, ib)
| 1677 | return Camera(**out) |
| 1678 | |
| 1679 | def __getitem__(self, ib) -> 'Camera': |
| 1680 | """slice the camera in the b dimension. Always retain (b, q, 4, 4) |
| 1681 | even when ib is int.""" |
| 1682 | if isinstance(ib, (int, torch.Size)): |
| 1683 | ib = slice(int(ib), int(ib) + 1) |
| 1684 | |
| 1685 | camera = Camera( |
| 1686 | H_c2w=self.H_c2w[ib], |
| 1687 | intrinsic=self.intrinsic[ib], |
| 1688 | width_px=self.width_px, |
| 1689 | height_px=self.height_px, |
| 1690 | ) |
| 1691 | assert camera.H_c2w.ndim == 4 |
| 1692 | assert camera.intrinsic.ndim == 4 |
| 1693 | return camera |
| 1694 | |
| 1695 | def state_dict(self) -> T.Dict[str, T.Any]: |
| 1696 | """Returns a dictionary that can be saved or load.""" |