MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / OverlapPatchEmbed

Class OverlapPatchEmbed

monai/networks/nets/restormer.py:61–87  ·  view source on GitHub ↗

Initial feature extraction using overlapped convolutions. Unlike standard patch embeddings that use non-overlapping patches, this approach maintains spatial continuity through 3x3 convolutions. Args: spatial_dims: Number of spatial dimensions (2D or 3D) in_channels: Numb

Source from the content-addressed store, hash-verified

59
60
61class OverlapPatchEmbed(Convolution):
62 """Initial feature extraction using overlapped convolutions.
63 Unlike standard patch embeddings that use non-overlapping patches,
64 this approach maintains spatial continuity through 3x3 convolutions.
65
66 Args:
67 spatial_dims: Number of spatial dimensions (2D or 3D)
68 in_channels: Number of input channels
69 embed_dim: Dimension of embedded features. Defaults to 48.
70 bias: Whether to use bias in convolution layer. Defaults to False.
71 """
72
73 def __init__(self, spatial_dims: int, in_channels: int = 3, embed_dim: int = 48, bias: bool = False):
74 super().__init__(
75 spatial_dims=spatial_dims,
76 in_channels=in_channels,
77 out_channels=embed_dim,
78 kernel_size=3,
79 strides=1,
80 padding=1,
81 bias=bias,
82 conv_only=True,
83 )
84
85 def forward(self, x: torch.Tensor) -> torch.Tensor:
86 x = super().forward(x)
87 return x
88
89
90class Restormer(nn.Module):

Callers 2

test_shapeMethod · 0.90
__init__Method · 0.85

Calls

no outgoing calls

Tested by 1

test_shapeMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…