Thanks for the inputs.
This error appears at the execution of  def getitem(self,index) function for the dataloader.
It is because images in the data set has different number of labels, and therefore they have different length. I am looking for the alternate ways to encode labels so that i can use other loss functions than nn.BCEWithLogitsLoss().
Thanks