Hi Hell!



 Hell_Razor:

MLPUpdated from models is same as MLPUpdated.


No it’s not:
>>> import torch
>>> 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)
...
>>> model = MLPUpdated()
>>> type (model)
<class '__main__.MLPUpdated'>
>>> model.send
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<...>\torch\nn\modules\module.py", line 1131, in __getattr__
    type(self).__name__, name))
AttributeError: 'MLPUpdated' object has no attribute 'send'

I guarantee that your “models” version of MLPUpdated does not have
type <class '__main__.MLPUpdated'>.  Also, in your code that is
not self-contained you call model.send().  Your free-standing version
of MLPUpdated does not have a .send() method.
Perhaps you copy-pasted some lines of code out of some more
elaborate context and thought things would be the same, but lacking
that larger context, there is no reason they should be.


Still I don’t understand the difference between train and test call for model.


In my previous reply I excerpted the relevant portions of the code you
posted.
Among other things you call model.send() / model.get() in your
training loop, but not in your test loop.  Also, you get your data
object from different data loaders, so there is no reason to expect
them to be of the same or similar type.
Did you try any of the things I suggested in my previous post?
Best.
K. Frank