# Passing the weights to BCELosswithlogits correctly

**URL:** <https://discuss.pytorch.org/t/passing-the-weights-to-bcelosswithlogits-correctly/33697>\
**Category:** Uncategorized\
**Created:** [January 3, 2019, 4:05pm UTC](https://discuss.pytorch.org/t/passing-the-weights-to-bcelosswithlogits-correctly/33697 "2019-01-03T16:05:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafi\_zunaed](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/r/7993a0/32.png) [@Rafi\_zunaed](https://discuss.pytorch.org/u/Rafi_zunaed)\
**Post date:** [January 3, 2019, 4:05pm UTC](https://discuss.pytorch.org/t/passing-the-weights-to-bcelosswithlogits-correctly/33697/1 "2019-01-03T16:05:58Z")

</div>

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”?
