Skip to content

Commit

Permalink
[测试] 测试代码修正
Browse files Browse the repository at this point in the history
  • Loading branch information
Apolsus committed Dec 28, 2022
1 parent fb0d39d commit 6554170
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/core_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def test_transpose(self):

def test_reshape(self):
t1 = Tensor([[1, 2, 3], [4, 5, 6]], autograd=True)
t2 = t1.reshape(6)
t2 = t1.reshape((6,))
assert (t2.data == np.array([1, 2, 3, 4, 5, 6])).all()
t2.backward()
assert (t1.grad == np.ones_like(t1.data)).all()
Expand All @@ -245,7 +245,7 @@ def test_linear(self):
autograd=False
)
m = Linear(3, 1)
opt = SGD(parameters=m.params(), lr=0.01)
opt = SGD(parameters=m.parameters(), lr=0.01)
pred = m(data)
for i in range(1000):
loss = ((pred - Tensor(1.)) ** 2.).sum(0)
Expand Down

0 comments on commit 6554170

Please sign in to comment.