mirror of https://github.com/Jittor/Jittor
Merge branch 'master' of https://github.com/Jittor/jittor
This commit is contained in:
commit
415aa4663d
|
@ -59,7 +59,7 @@ optim = nn.SGD (model.parameters(), learning_rate)
|
|||
|
||||
for i,(x,y) in enumerate(get_data(n)):
|
||||
pred_y = model(x)
|
||||
loss = ((pred_y - y)**2)
|
||||
loss = jt.sqr(pred_y - y)
|
||||
loss_mean = loss.mean()
|
||||
optim.step (loss_mean)
|
||||
print(f"step {i}, loss = {loss_mean.data.sum()}")
|
||||
|
|
|
@ -102,7 +102,7 @@ def conv(x, w):
|
|||
])
|
||||
ww = w.broadcast_var(xx)
|
||||
yy = xx*ww
|
||||
y = yy.sum([3,4,5]) # Kh, Kw, Kc
|
||||
y = yy.sum([3,4,5]) # Kh, Kw, c
|
||||
return y
|
||||
|
||||
# Let's disable tuner. This will cause jittor not to use mkl for convolution
|
||||
|
@ -150,7 +150,7 @@ xx = x.reindex([N,H-Kh+1,W-Kw+1,Kh,Kw,C,Kc], [
|
|||
])
|
||||
ww = w.broadcast_var(xx)
|
||||
yy = xx*ww
|
||||
y = yy.sum([3,4,5]) # Kh, Kw, Kc
|
||||
y = yy.sum([3,4,5]) # Kh, Kw, C
|
||||
```
|
||||
|
||||
**After expansion:**
|
||||
|
|
|
@ -21,7 +21,7 @@ def conv(x, w):
|
|||
])
|
||||
ww = w.broadcast_var(xx)
|
||||
yy = xx*ww
|
||||
y = yy.sum([3,4,5]) # Kh, Kw, Kc
|
||||
y = yy.sum([3,4,5]) # Kh, Kw, C
|
||||
return y, yy
|
||||
|
||||
def conv_naive(x, w):
|
||||
|
@ -52,7 +52,7 @@ def conv_transpose(x, w):
|
|||
], 0, ['(i1-i3)%2', '(i2-i4)%2'])
|
||||
ww = w.broadcast_var(xx)
|
||||
yy = xx*ww
|
||||
y = yy.sum([3,4,5]) # Kh, Kw, Kc
|
||||
y = yy.sum([3,4,5]) # Kh, Kw, C
|
||||
return y, yy
|
||||
|
||||
def conv_transpose_naive(x, w):
|
||||
|
|
|
@ -86,7 +86,7 @@ struct ReindexOp : Op {
|
|||
])
|
||||
ww = w.broadcast_var(xx)
|
||||
yy = xx*ww
|
||||
y = yy.sum([3,4,5]) # Kh, Kw, Kc
|
||||
y = yy.sum([3,4,5]) # Kh, Kw, C
|
||||
return y, yy
|
||||
```
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue