Why can't F.l1_loss be used for tensor arithmetic

I’m going through the course for the first time and in chapter 4 it states that the following are equivalent:

  • (a_3 - mean7).abs().mean()
  • F.l1_loss(a_3.float(),mean7)

However when using the F.l1_loss to calculate distance in the broadcasting example the function fails. Why?

I had a look at the doc for both abs and F.l1_loss but they aren’t very helpful

https://pytorch.org/docs/stable/generated/torch.abs.html#torch.abs

https://pytorch.org/docs/master/generated/torch.nn.functional.l1_loss.html#torch.nn.functional.l1_loss

But judging from the error it looks like the l1_loss isn’t capable of broadcasting?

TIA for any answers, thoughts, or other lines of investigation.