在fastai小批量培训课程中遇到运行时错误

时间:2019-10-31 11:06:09

标签: neural-network fast-ai mini-batch

bs=64                  # batch size

xb = x_train[0:bs]     # a mini-batch from x
preds = model(xb)      # predictions
preds[0], preds.shape
yb = y_train[0:bs]
loss_func(preds, yb)

IndexError Traceback(最近一次通话最近)  在()中 ----> 1 loss_func(preds,yb)

nll中的

(输入,目标)       1 def nll(输入,目标): ----> 2 return -input [range(target.shape [0]),target] .mean()

IndexError:用作索引的张量必须为long,byte或bool张量

0 个答案:

没有答案