MCPcopy Create free account
hub / github.com/PolyU-ChenLab/UniPixel / __init__

Method __init__

sam2/modeling/position_encoding.py:139–146  ·  view source on GitHub ↗
(self, num_pos_feats: int = 64, scale: Optional[float] = None)

Source from the content-addressed store, hash-verified

137 """
138
139 def __init__(self, num_pos_feats: int = 64, scale: Optional[float] = None) -> None:
140 super().__init__()
141 if scale is None or scale <= 0.0:
142 scale = 1.0
143 self.register_buffer(
144 "positional_encoding_gaussian_matrix",
145 scale * torch.randn((2, num_pos_feats)),
146 )
147
148 @torch.no_grad()
149 def _pe_encoding(self, coords: torch.Tensor) -> torch.Tensor:

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected