AttributeError: module 'torch.nn' has no attribute 'BCEloss'

This might be something straightforward but, I’m not sure why I have this error since the documentation clearly shows there should be a BCELoss() class. Any ideas will be helpful! Thanks!

Here is my code that generates the problem:

import torch
import torch.nn as nn
# Loss and optimizer
criterion = nn.BCEloss()

It seems the l is lowercase in your example. Try nn.BCELoss with an uppercase L.

Thanks for the reply! Yes that’s indeed the problem… thanks for catching it!