mirror of https://github.com/commaai/tinygrad.git
simpler
This commit is contained in:
parent
bee89a4840
commit
4faf3a0aed
|
@ -159,13 +159,12 @@ class Conv2D(Function):
|
|||
def forward(ctx, x, w):
|
||||
cout,cin,H,W = w.shape
|
||||
ret = np.zeros((x.shape[0], cout, x.shape[2]-(H-1), x.shape[3]-(W-1)), dtype=w.dtype)
|
||||
for Y in range(ret.shape[2]):
|
||||
for X in range(ret.shape[3]):
|
||||
for j in range(H):
|
||||
for i in range(W):
|
||||
tx = x[:, :, Y+j, X+i]
|
||||
tw = w[:, :, j, i]
|
||||
ret[:, :, Y, X] += tx.dot(tw.T)
|
||||
for j in range(H):
|
||||
for i in range(W):
|
||||
tw = w[:, :, j, i]
|
||||
for Y in range(ret.shape[2]):
|
||||
for X in range(ret.shape[3]):
|
||||
ret[:, :, Y, X] += x[:, :, Y+j, X+i].dot(tw.T)
|
||||
return ret
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue