MCPcopy Create free account
hub / github.com/ChunmingHe/WS-SAM / __init__

Method __init__

lib/Slot.py:23–32  ·  view source on GitHub ↗

Builds the soft position embedding layer. Args: hidden_size: Size of input feature dimension. resolution: Tuple of integers specifying width and height of grid.

(self, hidden_size, resolution)

Source from the content-addressed store, hash-verified

21 """Adds soft positional embedding with learnable projection."""
22
23 def __init__(self, hidden_size, resolution):
24 """Builds the soft position embedding layer.
25
26 Args:
27 hidden_size: Size of input feature dimension.
28 resolution: Tuple of integers specifying width and height of grid.
29 """
30 super(SoftPositionEmbed, self).__init__()
31 self.proj = nn.Linear(4, hidden_size)
32 self.grid = build_grid(resolution)
33
34 def forward(self, inputs):
35 device = inputs.device

Callers

nothing calls this directly

Calls 2

build_gridFunction · 0.85
__init__Method · 0.45

Tested by

no test coverage detected