Hi, I just made a little bit change in the code and apply “DataParallel” as below. It shows the error "AttributeError: ‘DataParallel’ object has no attribute ‘layer_1’ ".

DROP OUT CHECK
import torch
import torch.nn as nn
class Test(nn.Module):
def __init__(self, pool_size=(4, 4)):
    super(Test, self).__init__()
    self.layer_1 = nn.Sequential(nn.Linear(1, 1, bias=False),
                 nn.Dropout())

  

def forward(self, x):
    out = self.dropout(self.layer_1(x))
    return out

model=Test();

ADDED EXTRA 2 LINES AS BELOW
model.to(0)
model = torch.nn.DataParallel(model, [0])
model.train();
print("train model is : ",model)
print("training ",model.layer_1[1].training)
model.eval();
print("testing model ",model.layer_1[1].training)