MCPcopy Create free account
hub / github.com/Ropedia/SpatialBench / forward

Method forward

benchmark/models/lingbot_map/layers/block.py:508–530  ·  view source on GitHub ↗
(self, x: Tensor, pos=None, enable_ulysses_cp=False,
                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)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected