コード例 #1
0
ファイル: flows.py プロジェクト: rikrd/torchkit
    def __init__(self, dim1, dim2, context_dim, hid_dim, activation=nn.ELU()):
        super(BlockAffineFlow, self).__init__()
        self.dim1 = dim1
        self.dim2 = dim2
        self.actv = activation

        self.hid = nn_.WNBilinear(dim1, context_dim, hid_dim)
        self.shift = nn_.WNBilinear(hid_dim, context_dim, dim2)
コード例 #2
0
 def __init__(self, dim, context_dim, hid_dim, 
              mask=0, realify=nn_.softplus):
     super(BlockAffineFlow, self).__init__()
     self.mask = mask
     self.dim = dim
     self.realify = realify
     self.gpu = True
     
     self.hid = nn_.WNBilinear(dim, context_dim, hid_dim)
     self.mean = nn_.ResLinear(hid_dim, dim)
     self.lstd = nn_.ResLinear(hid_dim, dim)