curvature training
This commit is contained in:
+5
-5
@@ -33,10 +33,10 @@ class VariationalEncoder(nn.Module):
|
||||
|
||||
class AEEncoder(nn.Module):
|
||||
|
||||
def __init__(self, block_setting: CNBlockConfig, kernel_size: int = 7, activation='tanh', device='cuda'):
|
||||
def __init__(self, block_setting: CNBlockConfig, kernel_size: int = 7, activation='tanh', is_label=False, nr_of_labels=None, device='cuda'):
|
||||
super(AEEncoder, self).__init__()
|
||||
|
||||
self.encoder = ConvNeXt(block_setting=block_setting, kernel_size=kernel_size, device=device)
|
||||
self.encoder = ConvNeXt(block_setting=block_setting, kernel_size=kernel_size, is_label=is_label, nr_of_labels=nr_of_labels, device=device)
|
||||
if activation == 'tanh':
|
||||
self.act = nn.Tanh()
|
||||
elif activation == 'sigmoid':
|
||||
@@ -81,10 +81,10 @@ class Decoder(nn.Module):
|
||||
x = self.decoder(x)
|
||||
|
||||
if self.is_label:
|
||||
x = x * mask[:,:,:,None]
|
||||
x = x * mask[:,None,:,:]
|
||||
|
||||
background = torch.ones((mask.shape[0],512,256,1), device=mask.get_device()) * (1 - mask[:,:,:,None])
|
||||
x = torch.concat((background, x), axis=-1)
|
||||
background = torch.ones((mask.shape[0],1,512,256), device=mask.get_device()) * (1 - mask[:,None,:,:])
|
||||
x = torch.concat((background, x), dim=1)
|
||||
x = self.softmax(x)
|
||||
|
||||
if len(inputs) == 2:
|
||||
|
||||
Reference in New Issue
Block a user