I have reverted my code back to have loss = criterion : where criterion is
criterion = nn.CrossEntropyLoss()

I printed the shape of the input data, the target(label) data and the ouput shape from output = net(data)
below is the error trace.
data shape = torch.Size([4, 150, 64, 64])
target shape = torch.Size([4])
output shape = torch.Size([4, 4, 64, 64])

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-34-48f9f0494335> in <module>
      7               display_iter=100,
      8                 display=None,
----> 9               val_loader=None)

<ipython-input-32-a961c92dfd2f> in train(self, net, optimizer, criterion, data_loader, epoch, scheduler, display_iter, display, val_loader)
     67                     output = net(data)
     68                     print(f"output shape = {output.shape}")
---> 69                     loss = criterion(output, target)
     70                     print(f"loss = {loss}")
     71                 elif self.supervision == 'semi':

~\AppData\Local\Continuum\anaconda3\envs\Hyperspectral_testbed\lib\site-packages\torch\nn\modules\module.py in __call__(self, *input, **kwargs)
    487             result = self._slow_forward(*input, **kwargs)
    488         else:
--> 489             result = self.forward(*input, **kwargs)
    490         for hook in self._forward_hooks.values():
    491             hook_result = hook(self, input, result)

~\AppData\Local\Continuum\anaconda3\envs\Hyperspectral_testbed\lib\site-packages\torch\nn\modules\loss.py in forward(self, input, target)
    902     def forward(self, input, target):
    903         return F.cross_entropy(input, target, weight=self.weight,
--> 904                                ignore_index=self.ignore_index, reduction=self.reduction)
    905 
    906 

~\AppData\Local\Continuum\anaconda3\envs\Hyperspectral_testbed\lib\site-packages\torch\nn\functional.py in cross_entropy(input, target, weight, size_average, ignore_index, reduce, reduction)
   1968     if size_average is not None or reduce is not None:
   1969         reduction = _Reduction.legacy_get_string(size_average, reduce)
-> 1970     return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)
   1971 
   1972 

~\AppData\Local\Continuum\anaconda3\envs\Hyperspectral_testbed\lib\site-packages\torch\nn\functional.py in nll_loss(input, target, weight, size_average, ignore_index, reduce, reduction)
   1790         ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
   1791     elif dim == 4:
-> 1792         ret = torch._C._nn.nll_loss2d(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
   1793     else:
   1794         # dim == 3 or dim > 4

RuntimeError: 1only batches of spatial targets supported (non-empty 3D tensors) but got targets of size: : [4]