MCPcopy Create free account
hub / github.com/computational-imaging/bacon / forward

Method forward

modules.py:574–580  ·  view source on GitHub ↗

Apply positional encoding to the input.

(self, tensor)

Source from the content-addressed store, hash-verified

572 self.bvals = nn.Parameter(bvals, requires_grad=False)
573
574 def forward(self, tensor) -> torch.Tensor:
575 """
576 Apply positional encoding to the input.
577 """
578
579 return torch.cat([self.avals * torch.sin((2.*np.pi*tensor) @ self.bvals.T),
580 self.avals * torch.cos((2.*np.pi*tensor) @ self.bvals.T)], dim=-1)
581
582
583class PositionalEncoding(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected