Skip to content

TypeError: super() takes at least 1 argument (0 given) #5

@tlok666

Description

@tlok666

I used python2.7 to test the example:

import pyvarinf
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
class Net(nn.Module):
def init(self):
super(Net, self).init()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
self.fc1 = nn.Linear(320, 50)
self.fc2 = nn.Linear(50, 10)
self.bn1 = nn.BatchNorm2d(10)
self.bn2 = nn.BatchNorm2d(20)
def forward(self, x):
x = self.bn1(F.relu(F.max_pool2d(self.conv1(x), 2)))
x = self.bn2(F.relu(F.max_pool2d(self.conv2(x), 2)))
x = x.view(-1, 320)
x = F.relu(self.fc1(x))
x = self.fc2(x)
return F.log_softmax(x)
model = Net()
var_model = pyvarinf.Variationalize(model)
var_model.cuda()

But Error report: TypeError: super() takes at least 1 argument (0 given)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions