Пример #1
0
    def __init__(self, config):
        super(SelfAttention, self).__init__()
        self.config = config
        self.device = torch.device(
            "cuda:1" if torch.cuda.is_available() else 'cpu')

        self.SA = BertSelfAttention(config)
        self.tanh = torch.nn.Tanh()
Пример #2
0
 def __init__(self, config, opt):
     super(SelfAttention, self).__init__()
     self.opt = opt
     self.config = config
     self.SA = BertSelfAttention(config)
     self.tanh = torch.nn.Tanh()
Пример #3
0
 def __init__(self, config, args):
     super(SelfAttention, self).__init__()
     self.args = args
     self.config = config
     self.SA = BertSelfAttention(config)
     self.tanh = torch.nn.Tanh()
Пример #4
0
 def __init__(self, config, L):
     super(SelfAttention, self).__init__()
     self.SA = BertSelfAttention(config)
     self.L = L
     self.pooler = BertPooler(config)