Lesson 2 : prediction doesn't return name of class but tensor


Can anyone advice why pred_class returns a tensor class rather than the name of the class i.e teddys?
Is there a step that I miss but when I data.classes , the class was captured?


1 Like

To get the name, you should do pred_class.obj. It’s a bit different I know, but this process is a bit different in fastai2 as well, so it’s not a bug, simply a modification in the library :slight_smile:

(Another way is to do data.classes[pred_idx])

1 Like

Hi , thanks it’s working now.

I notice the difference when I came back to this notebook after quite sometime. I also encountered this error and sync both the versions.