MCPcopy
hub / github.com/tinygrad/tinygrad / TinyNet

Class TinyNet

test/backend/test_optim.py:23–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 return (self.x * self.W).sum()
22
23class TinyNet:
24 def __init__(self, tensor):
25 self.x = _param(tensor, x_init.copy())
26 self.W = _param(tensor, W_init.copy())
27 self.m = tensor(m_init.copy())
28
29 def forward(self):
30 out = self.x.matmul(self.W).relu()
31 # print(out.detach().numpy())
32 out = out.log_softmax(1)
33 out = out.mul(self.m).add(self.m).sum()
34 return out
35
36def step(tensor, optim, steps=1, teeny=False, **kwargs):
37 net = TeenyNet(tensor) if teeny else TinyNet(tensor)

Callers 1

stepFunction · 0.70

Calls

no outgoing calls

Tested by 1

stepFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…