MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / __init__

Method __init__

modeling/g2vlm/modeling_utils.py:128–136  ·  view source on GitHub ↗
(self, max_num_patch_per_side, hidden_size)

Source from the content-addressed store, hash-verified

126
127class PositionEmbedding(nn.Module):
128 def __init__(self, max_num_patch_per_side, hidden_size):
129 super().__init__()
130 self.max_num_patch_per_side = max_num_patch_per_side
131 self.hidden_size = hidden_size
132 self.pos_embed = nn.Parameter(
133 torch.zeros(max_num_patch_per_side ** 2, hidden_size),
134 requires_grad=False
135 )
136 self._init_weights()
137
138 def _init_weights(self):
139 # Initialize (and freeze) pos_embed by sin-cos embedding:

Callers

nothing calls this directly

Calls 2

_init_weightsMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected