def score_h(self, rt_batch: torch.LongTensor) -> torch.FloatTensor:
    h = self.entity_embeddings.weight
    r = self.relation_embeddings(rt_batch[:, 0]).view((- 1), self.embedding_dim)
    t = self.entity_embeddings(rt_batch[:, 1]).view((- 1), self.embedding_dim)
    self.regularize_if_necessary(h, r, t)
    rt_batch_size = t.shape[0]
    r = torch.repeat_interleave(r, self.num_entities, dim=0)
    h = h.repeat(rt_batch_size, 1)
    t = t.repeat_interleave(self.num_entities, dim=0)
    x_s = torch.cat([h, r], dim=(- 1))
    x_s = self.input_dropout(x_s)
    x_t = self.mlp(x_s)
    x = (x_t.view((- 1), self.embedding_dim) * t).sum(dim=1, keepdim=True)
    x = x.view(rt_batch_size, self.num_entities)
    return x
def score_h(self, rt_batch: torch.LongTensor) -> torch.FloatTensor:
    h = self.entity_embeddings.weight
    r = self.relation_embeddings(rt_batch[:, 0]).view((- 1), self.embedding_dim)
    t = self.entity_embeddings(rt_batch[:, 1]).view((- 1), self.embedding_dim)
    self.regularize_if_necessary(h, r, t)
    rt_batch_size = t.shape[0]
    r = torch.repeat_interleave(r, self.num_entities, dim=0)
    h = h.repeat(rt_batch_size, 1)
    t = t.repeat_interleave(self.num_entities, dim=0)
    x_s = torch.cat([h, r], dim=(- 1))
    x_s = self.input_dropout(x_s)
    x_t = self.mlp(x_s)
    x = (x_t.view((- 1), self.embedding_dim) * t).sum(dim=1, keepdim=True)
    x = x.view(rt_batch_size, self.num_entities)
    return x