It looks like you have replaced the internal self.train() method inside your model with a bool value:
class MyModel(nn.Module):
    def __init__(self, train):
        super(MyModel, self).__init__()
        self.bn = nn.BatchNorm2d(3)
        self.train = train

    def forward(self, x):
        x = self.bn(x)
        return x

Note that self.train() is defined as a method in all nn.Modules, so you should use another name.