MCPcopy Create free account
hub / github.com/apple/ml-sharp / _create_block

Method _create_block

src/sharp/models/blocks.py:190–204  ·  view source on GitHub ↗
(dim: int, batch_norm: bool)

Source from the content-addressed store, hash-verified

188 """Create a residual block."""
189
190 def _create_block(dim: int, batch_norm: bool) -> list[nn.Module]:
191 layers = [
192 nn.ReLU(False),
193 nn.Conv2d(
194 num_features,
195 num_features,
196 kernel_size=3,
197 stride=1,
198 padding=1,
199 bias=not batch_norm,
200 ),
201 ]
202 if batch_norm:
203 layers.append(nn.BatchNorm2d(dim))
204 return layers
205
206 residual = nn.Sequential(
207 *_create_block(dim=num_features, batch_norm=batch_norm),

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected