Passing the weights to BCELosswithlogits correctly

I am trying to use weighting for each class. Should i pass weights as 1xC(class) at the beginning, when i will define the loss function or pass as NxC during each batch of training? I do not understand what does the pytorch docs of BCELosswithlogits mean by “If given, has to be a Tensor of size nbatch”?