(self, x: Tensor, pos=None,
num_patches=None, num_special=None, num_frames=None, enable_3d_rope=False,
kv_cache=None, global_idx=0, num_frame_per_block=1,
num_frame_for_scale=-1, num_register_tokens=4)
| 508 | self.sample_drop_ratio = drop_path |
| 509 | |
| 510 | def forward(self, x: Tensor, pos=None, |
| 511 | num_patches=None, num_special=None, num_frames=None, enable_3d_rope=False, |
| 512 | kv_cache=None, global_idx=0, num_frame_per_block=1, |
| 513 | num_frame_for_scale=-1, num_register_tokens=4) -> Tensor: |
| 514 | def attn_residual_func(x, pos=None): |
| 515 | return self.ls1(self.attn( |
| 516 | self.norm1(x), pos=pos, |
| 517 | num_patches=num_patches, num_special=num_special, num_frames=num_frames, |
| 518 | enable_3d_rope=enable_3d_rope, kv_cache=kv_cache, global_idx=global_idx, |
| 519 | num_frame_per_block=num_frame_per_block, num_frame_for_scale=num_frame_for_scale, |
| 520 | num_register_tokens=num_register_tokens, |
| 521 | )) |
| 522 | |
| 523 | def ffn_residual_func(x): |
| 524 | return self.ls2(self.mlp(self.norm2(x))) |
| 525 | |
| 526 | if self.training and self.sample_drop_ratio > 0.0: |
| 527 | x = x + self.drop_path1(attn_residual_func(x, pos=pos)) |
| 528 | x = x + self.drop_path1(ffn_residual_func(x)) |
| 529 | else: |
| 530 | x = x + attn_residual_func(x, pos=pos) |
| 531 | x = x + ffn_residual_func(x) |
| 532 | return x |
nothing calls this directly
no outgoing calls
no test coverage detected