MCPcopy Create free account
hub / github.com/tdrussell/diffusion-pipe / __init__

Method __init__

models/cosmos_predict2_modeling.py:804–828  ·  view source on GitHub ↗
(
        self,
        spatial_patch_size: int,
        temporal_patch_size: int,
        in_channels: int = 3,
        out_channels: int = 768,
    )

Source from the content-addressed store, hash-verified

802 """
803
804 def __init__(
805 self,
806 spatial_patch_size: int,
807 temporal_patch_size: int,
808 in_channels: int = 3,
809 out_channels: int = 768,
810 ):
811 super().__init__()
812 self.spatial_patch_size = spatial_patch_size
813 self.temporal_patch_size = temporal_patch_size
814
815 self.proj = nn.Sequential(
816 Rearrange(
817 "b c (t r) (h m) (w n) -> b t h w (c r m n)",
818 r=temporal_patch_size,
819 m=spatial_patch_size,
820 n=spatial_patch_size,
821 ),
822 nn.Linear(
823 in_channels * spatial_patch_size * spatial_patch_size * temporal_patch_size, out_channels, bias=False
824 ),
825 )
826 self.dim = in_channels * spatial_patch_size * spatial_patch_size * temporal_patch_size
827
828 self.init_weights()
829
830 def init_weights(self) -> None:
831 std = 1.0 / math.sqrt(self.dim)

Callers

nothing calls this directly

Calls 2

init_weightsMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected