MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / __init__

Method __init__

tests/unit/simple_model.py:148–161  ·  view source on GitHub ↗
(self, input_dim=128, hidden_dim=128, output_dim=128, num_layers=4)

Source from the content-addressed store, hash-verified

146class LinearStack(torch.nn.Module):
147
148 def __init__(self, input_dim=128, hidden_dim=128, output_dim=128, num_layers=4):
149 super().__init__()
150 self.input_dim = input_dim
151 self.output_dim = output_dim
152 self.hidden_dim = hidden_dim
153
154 self.input_layer = torch.nn.Linear(in_features=self.input_dim, out_features=self.hidden_dim)
155 self.layers = torch.nn.ModuleList([
156 torch.nn.Linear(in_features=self.hidden_dim, out_features=self.hidden_dim, bias=False)
157 for x in range(num_layers)
158 ])
159 self.output_layer = torch.nn.Linear(in_features=self.hidden_dim, out_features=self.output_dim)
160
161 self.cross_entropy_loss = torch.nn.CrossEntropyLoss()
162
163 def forward(self, x, y):
164 x = self.input_layer(x)

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected