MCPcopy Create free account
hub / github.com/cvg/NoPoSplat / __init__

Method __init__

src/model/encodings/positional_encoding.py:14–26  ·  view source on GitHub ↗
(self, num_octaves: int)

Source from the content-addressed store, hash-verified

12 phases: Float[Tensor, "frequency phase"]
13
14 def __init__(self, num_octaves: int):
15 super().__init__()
16 octaves = torch.arange(num_octaves).float()
17
18 # The lowest frequency has a period of 1.
19 frequencies = 2 * torch.pi * 2**octaves
20 frequencies = repeat(frequencies, "f -> f p", p=2)
21 self.register_buffer("frequencies", frequencies, persistent=False)
22
23 # Choose the phases to match sine and cosine.
24 phases = torch.tensor([0, 0.5 * torch.pi], dtype=torch.float32)
25 phases = repeat(phases, "p -> f p", f=num_octaves)
26 self.register_buffer("phases", phases, persistent=False)
27
28 def forward(
29 self,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected