Another error that pops up after removing the pooling layers is:
IndexError: dimension specified as 0 but tensor has no dimensions

Kindly suggest what is going wrong. Is it the data I have uploaded?
IndexError                                Traceback (most recent call last)
<ipython-input-10-86dbc70a4dd9> in <module>
     25       print(output)
     26         # Calculating loss
---> 27       loss = loss_func(output, Y_train)
     28         # Backward pass
     29       loss.backward()

~\anaconda3\lib\site-packages\torch\nn\modules\module.py in _call_impl(self, *input, **kwargs)
    887             result = self._slow_forward(*input, **kwargs)
    888         else:
--> 889             result = self.forward(*input, **kwargs)
    890         for hook in itertools.chain(
    891                 _global_forward_hooks.values(),

~\anaconda3\lib\site-packages\torch\nn\modules\loss.py in forward(self, input, target)
    214     def forward(self, input: Tensor, target: Tensor) -> Tensor:
    215         assert self.weight is None or isinstance(self.weight, Tensor)
--> 216         return F.nll_loss(input, target, weight=self.weight, ignore_index=self.ignore_index, reduction=self.reduction)
    217 
    218 

~\anaconda3\lib\site-packages\torch\nn\functional.py in nll_loss(input, target, weight, size_average, ignore_index, reduce, reduction)
   2381         raise ValueError("Expected 2 or more dimensions (got {})".format(dim))
   2382 
-> 2383     if input.size(0) != target.size(0):
   2384         raise ValueError(
   2385             "Expected input batch_size ({}) to match target batch_size ({}).".format(input.size(0), target.size(0))

IndexError: dimension specified as 0 but tensor has no dimensions