Spaces:
Paused
Paused
Download src/dataset/view_sampler/three_view_hack.py from timfromhcs/AnySplat: direct link, hf CLI and curl.
- Browser
- Download file 270 Bytes
-
https://huggingface.co/spaces/timfromhcs/AnySplat/resolve/main/src/dataset/view_sampler/three_view_hack.py
- Command line
-
hf download hf://spaces/timfromhcs/AnySplat/src/dataset/view_sampler/three_view_hack.py
-
curl -L -o three_view_hack.py https://huggingface.co/spaces/timfromhcs/AnySplat/resolve/main/src/dataset/view_sampler/three_view_hack.py
270 Bytes
| import torch | |
| from jaxtyping import Int | |
| from torch import Tensor | |
| def add_third_context_index( | |
| indices: Int[Tensor, "*batch 2"] | |
| ) -> Int[Tensor, "*batch 3"]: | |
| left, right = indices.unbind(dim=-1) | |
| return torch.stack((left, (left + right) // 2, right), dim=-1) | |