https://zh.d2l.ai/chapter_linear-networks/linear-regression-concise.html
第二题一直报错,就是numpy的和ndArray的
loss = gluon.loss.HuberLoss()
for epoch in range(num_epochs):
for X, y in data_iter:
with autograd.record():
l = loss(net(X), y)
l.backward()
trainer.step(batch_size)
l = loss(net(features), labels)
print(f'epoch {epoch + 1}, loss {l.mean().asnumpy():f}')
TypeError: Operator
_npx_fully_connected
registered in backend is known as
fully_connected
in Python. This is a numpy operator which can only accept MXNet numpy ndarrays, while received a legacy ndarray. Please ensure that you have activated numpy semantics by callingnpx.set_np()
in your code. If you still see this error with numpy semantics activated, please callas_np_ndarray()
upon the legacy ndarray to convert it to an MXNet numpy ndarray, and then feed the converted array to this operator.
转换为ndArray报其他错误,要转换numpy的array.转换为numpy的array,说什么要转换为ndarray,我他妈人都傻了,真死锁
兄弟,问题找到了吗,我版本换到最新的也有这个问题