def __init__(self): torch.nn.Module.__init__(self) self.conv1 = torchwriter.conv3x3(nInChans, nOutChans) self.conv2 = torchwriter.conv3x3(nOutChans, nOutChans) self.sin = torch.sin # number of classes = nOutChans self.linear = x = torch.nn.Linear(nOutChans, nOutChans)
def __init__(self): torch.nn.Module.__init__(self) self.conv1 = torchwriter.conv3x3(nInChans, nOutChans) self.conv2 = torchwriter.conv3x3(nOutChans, nOutChans) self.sin = torch.sin # for softmax dim -1 is correct for [sample][class], # gives class probabilities for each sample. self.softmax = torch.nn.Softmax(dim=-1)
def __init__(self): torch.nn.Module.__init__(self) self.conv1 = torchwriter.conv3x3(nChans, oChans) self.conv2 = torchwriter.conv3x3(oChans, oChans) self.weights = torch.nn.Parameter(torch.rand(10, 5)) self.relu = torch.nn.functional.relu self.matmul = torch.matmul
def __init__(self): torch.nn.Module.__init__(self) self.sin = torch.sin self.conv1 = torchwriter.conv3x3(nInChans, nOutChans) self.conv2 = torchwriter.conv3x3(nOutChans, nOutChans) self.bn2 = torch.nn.BatchNorm2d(nOutChans, eps=0.1) self.conv3 = torchwriter.conv3x3(nOutChans, nOutChans) self.bn3 = torch.nn.BatchNorm2d(nOutChans, eps=0.1)
def __init__(self): torch.nn.Module.__init__(self) self.conv1 = torchwriter.conv3x3(nInChans, nOutChans) self.conv2 = torchwriter.conv3x3(nOutChans, nOutChans) torch.nn.init.constant_(self.conv2.weight, 0.02) torch.nn.init.constant_(self.conv1.weight, 0.02) self.sin = torch.sin self.pad = torch.nn.functional.pad # for softmax dim -1 is correct for [sample][class], # gives class probabilities for each sample. self.softmax = torch.nn.Softmax(dim=-1)
def __init__(self): torch.nn.Module.__init__(self) self.sin = torch.sin self.conv1 = torchwriter.conv3x3(nInChans, nOutChans) self.in2 = torch.nn.InstanceNorm2d(nOutChans, eps=0.1, affine=True, momentum=0) # Force random initialization np.random.seed(0) self.in2.weight.data = torch.tensor( np.random.rand(nOutChans).astype(np.float32))
def __init__(self): torch.nn.Module.__init__(self) self.conv1 = torchwriter.conv3x3(nChans, nChans) self.conv2 = torchwriter.conv3x3(nChans, nChans) self.relu = torch.nn.functional.relu
def __init__(self): torch.nn.Module.__init__(self) self.conv1 = torchwriter.conv3x3(nInChans, nOutChans) self.conv2 = torchwriter.conv3x3(nInChans, nOutChans)