MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / __init__

Method __init__

models/aios/position_encoding.py:13–26  ·  view source on GitHub ↗
(self,
                 num_pos_feats=64,
                 temperature=10000,
                 normalize=False,
                 scale=None)

Source from the content-addressed store, hash-verified

11 to the one used by the Attention is all you need paper, generalized to work
12 on images."""
13 def __init__(self,
14 num_pos_feats=64,
15 temperature=10000,
16 normalize=False,
17 scale=None):
18 super().__init__()
19 self.num_pos_feats = num_pos_feats
20 self.temperature = temperature
21 self.normalize = normalize
22 if scale is not None and normalize is False:
23 raise ValueError('normalize should be True if scale is passed')
24 if scale is None:
25 scale = 2 * math.pi
26 self.scale = scale
27
28 def forward(self, tensor_list: NestedTensor):
29 x = tensor_list.tensors

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected