Hi Hell!



 Hell_Razor:

As soon as I try to run test loop, it shows the above error.
The batch size is 1024, and input features 30.


You must not be calling your model correctly in your test loop; your
code works for me:
>>> import torch
>>> import torch.nn as nn
>>> torch.__version__
'1.9.0'
>>> class MLPUpdated(nn.Module):
...     def __init__(self):
...         super().__init__()
...         self.layers = nn.Sequential(
...             nn.Linear(30, 32),
...             nn.ReLU(),
...             nn.Dropout(0.2),
...             nn.Linear(32,16),
...             nn.ReLU(),
...             nn.Dropout(0.1),
...             nn.Linear(16, 8),
...             nn.ReLU(),
...             nn.Linear(8, 1),
...             nn.Sigmoid()
...         )
...
...     def forward(self, x):
...         return self.layers(x)
...
>>> _ = torch.manual_seed (2021)
>>> MLPUpdated() (torch.randn (1024, 30))
tensor([[0.4777],
        [0.4868],
        [0.4884],
        ...,
        [0.4624],
        [0.4619],
        [0.4893]], grad_fn=<SigmoidBackward>)

Best.
K. Frank