MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / __init__

Method __init__

models/custom.py:19–37  ·  view source on GitHub ↗
(self, in_channels: int = 3, num_classes: int = 1000)

Source from the content-addressed store, hash-verified

17 """
18
19 def __init__(self, in_channels: int = 3, num_classes: int = 1000):
20 super().__init__()
21 self.features = nn.Sequential(
22 nn.Conv2d(in_channels, 64, 7, stride=2, padding=3),
23 nn.BatchNorm2d(64),
24 nn.ReLU(inplace=True),
25 nn.MaxPool2d(3, stride=2, padding=1),
26 nn.Conv2d(64, 128, 3, padding=1),
27 nn.BatchNorm2d(128),
28 nn.ReLU(inplace=True),
29 nn.Conv2d(128, 256, 3, padding=1),
30 nn.BatchNorm2d(256),
31 nn.ReLU(inplace=True),
32 nn.AdaptiveAvgPool2d((1, 1)),
33 )
34 self.classifier = nn.Linear(256, num_classes)
35
36 n_params = sum(p.numel() for p in self.parameters())
37 print(f"MyModel: {n_params / 1e6:.1f}M parameters")
38
39 def forward(self, x: torch.Tensor) -> torch.Tensor:
40 x = self.features(x)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected