MCPcopy Index your code
hub / github.com/apple/ml-pointersect / __getitem__

Method __getitem__

pointersect/inference/structures.py:1679–1693  ·  view source on GitHub ↗

slice the camera in the b dimension. Always retain (b, q, 4, 4) even when ib is int.

(self, ib)

Source from the content-addressed store, hash-verified

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."""

Callers

nothing calls this directly

Calls 1

CameraClass · 0.85

Tested by

no test coverage detected