Learner Type Error

Hi Everyone: I just started learning fastai.

After completing chapter 4 of the book, I tried to code for the complete MNIST dataset.
I am getting the following error:

TypeError: no implementation found for ‘torch.nn.functional.cross_entropy’ on types that implement torch_function: [<class ‘fastai.torch_core.TensorImageBW’>, <class ‘fastai.torch_core.TensorCategory’>]

I will really appreciate any help on this.

My CODE

path = untar_data(URLs.MNIST)

mnist = DataBlock(
blocks=(ImageBlock(cls=PILImageBW), CategoryBlock),
get_items=get_image_files,
splitter=GrandparentSplitter(train_name=‘training’, valid_name=‘testing’),
get_y=parent_label,

)

dls = mnist.dataloaders(path, bs =64, shuffle=True)

simple_net = nn.Sequential(
nn.Flatten(),
nn.Linear(28*28, 30),
nn.ReLU(),
nn.Linear(30,10)
)

learn = Learner(dls, simple_net, opt_func=SGD,
loss_func=F.cross_entropy, metrics=accuracy)

learn.fit(3, 0.1)

Installed fastai again. I am not getting the error again.