Method
__init__
(self,
num_pos_feats=64,
temperatureH=10000,
temperatureW=10000,
normalize=False,
scale=None)
Source from the content-addressed store, hash-verified
| 59 | to the one used by the Attention is all you need paper, generalized to work |
| 60 | on images.""" |
| 61 | def __init__(self, |
| 62 | num_pos_feats=64, |
| 63 | temperatureH=10000, |
| 64 | temperatureW=10000, |
| 65 | normalize=False, |
| 66 | scale=None): |
| 67 | super().__init__() |
| 68 | self.num_pos_feats = num_pos_feats # 128 |
| 69 | self.temperatureH = temperatureH # 20 |
| 70 | self.temperatureW = temperatureW |
| 71 | self.normalize = normalize # true |
| 72 | if scale is not None and normalize is False: |
| 73 | raise ValueError('normalize should be True if scale is passed') |
| 74 | if scale is None: |
| 75 | scale = 2 * math.pi |
| 76 | self.scale = scale |
| 77 | |
| 78 | def forward(self, tensor_list: NestedTensor): |
| 79 | x = tensor_list.tensors |
Callers
nothing calls this directly
Tested by
no test coverage detected