Thank You,@ptrblck,  have replaced  nn.Sigmopid() with functional like torch.sigmoid()
but got the following error during training…
length of data_X =  128 torch.Size([128, 34])
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:7: UserWarning: To copy 
construct from a tensor, it is recommended to use sourceTensor.clone().detach() or 
sourceTensor.clone().detach().requires_grad_(True), rather than 
torch.tensor(sourceTensor).
  import sys
 /usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:11: UserWarning: To copy 
 construct from a tensor, it is recommended to use sourceTensor.clone().detach() or 
 sourceTensor.clone().detach().requires_grad_(True), rather than 
torch.tensor(sourceTensor).
 # This is added back by InteractiveShellApp.init_path()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-30-1023803e6516> in <module>()
     15         #outputs=model()
     16         labels = labels.squeeze_()


–> 17         loss = criterion(outputs, labels)
18         loss.backward()
19         optimizer.step()

3 frames
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in call(self, *input,
**kwargs)
539             result = self._slow_forward(*input, **kwargs)
540         else:
–> 541             result = self.forward(*input, **kwargs)
542         for hook in self._forward_hooks.values():
543             hook_result = hook(self, input, result)
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/loss.py in forward(self, input, 
 target)
    914     def forward(self, input, target):
    915         return F.cross_entropy(input, target, weight=self.weight,
--> 916                                ignore_index=self.ignore_index, reduction=self.reduction)
    917 
    918 

/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py in cross_entropy(input, target, 
weight, size_average, ignore_index, reduce, reduction)
   2007     if size_average is not None or reduce is not None:
   2008         reduction = _Reduction.legacy_get_string(size_average, reduce)
-> 2009     return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, 
reduction)
   2010 
   2011 

/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py in nll_loss(input, target, weight, 
size_average, ignore_index, reduce, reduction)
   1836                          .format(input.size(0), target.size(0)))
   1837     if dim == 2:
-> 1838         ret = torch._C._nn.nll_loss(input, target, weight, 
_Reduction.get_enum(reduction), ignore_index)
   1839     elif dim == 4:
   1840         ret = torch._C._nn.nll_loss2d(input, target, weight, 
_Reduction.get_enum(reduction), ignore_index)

 RuntimeError: Assertion `cur_target >= 0 && cur_target < n_classes' failed.  at 
/pytorch/aten/src/THNN/generic/ClassNLLCriterion.c:97