MCPcopy Create free account
hub / github.com/SafeAILab/EAGLE / paddingtensor2D

Method paddingtensor2D

eagle/train/main.py:187–191  ·  view source on GitHub ↗
(self, intensors, N)

Source from the content-addressed store, hash-verified

185 return outtensors
186
187 def paddingtensor2D(self, intensors, N):
188 B, n = intensors.shape
189 padding_tensor = torch.zeros(B, N - n, dtype=intensors.dtype)
190 outtensors = torch.cat((intensors, padding_tensor), dim=1)
191 return outtensors
192
193 def __call__(self, features: List[Dict[str, Any]]) -> Dict[str, Any]:
194 max_length = max(item['hidden_state_big'].shape[1] for item in features)

Callers 1

__call__Method · 0.95

Calls 1

catMethod · 0.45

Tested by

no test coverage detected