loss_func can be any loss function you like. It needs to be one of fastai’s if you want to use Learn.predict or Learn.get_preds, or you will have to implement special methods (see more details after the BaseLoss documentation).
try passing y_block = CategoryBlock in your TabularDataLoaders.from_df()?
and you need not pass loss_func argument explicitly if it is CrossEntropyLoss that you want as your loss, as it automatically does it for you based on your y_block. (try printing learn.loss_func after defining learner)
That’s true that we don’t need to define the CrossEntropyLoss using nn.CrossEntropyLoss, in this case I just want to try it, as I thought it should work