Error RuntimeError: Boolean value of Tensor with more than one value is ambiguous

Hi @ptrblck. Could you help me with these issue? Pleasee, help me

fig, axes = plt.subplots(6,6, figsize=(24,24))
for image, label, pred, ax in zip (feature, target, preds, axes.flatten()):
ax.imshow(image.permute(1,2,0).cpu())
font = {“color”: ‘r’} if label != pred else {“color”:‘g’}
label, pred = label2cat [label.item()], label2cat[preds.item()]
ax.set_title(f"Label: {label} | Pred: {pred}", fontdict= font);
ax.axis(“off”);

Please help me, how to fixed the error

Based on the error message it seems either label.item() or preds.item() is causing the error as one of them (or both) is containing multiple elements and thus cannot be converted to a scalar value.
I would also generally recommend not to tag specific users as it could demotivate other users to post a valid response.