Method
__init__
(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
Tested by
no test coverage detected