IR2Vec
Loading...
Searching...
No Matches
OpenKE.module.model.TransD.TransD Class Reference
Inheritance diagram for OpenKE.module.model.TransD.TransD:
Collaboration diagram for OpenKE.module.model.TransD.TransD:

Public Member Functions

 __init__ (self, ent_tot, rel_tot, dim_e=100, dim_r=100, p_norm=1, norm_flag=True, margin=None, epsilon=None)
 
 forward (self, data)
 
 regularization (self, data)
 
 predict (self, data)
 
- Public Member Functions inherited from OpenKE.module.model.Model.Model
- Public Member Functions inherited from OpenKE.module.BaseModule.BaseModule
 load_checkpoint (self, path)
 
 save_checkpoint (self, path)
 
 load_parameters (self, path)
 
 save_parameters (self, path)
 
 get_parameters (self, mode="numpy", param_dict=None)
 
 set_parameters (self, parameters)
 

Public Attributes

 dim_e = dim_e
 
 dim_r = dim_r
 
 margin = margin
 
 epsilon = epsilon
 
 norm_flag = norm_flag
 
 p_norm = p_norm
 
 ent_embeddings = nn.Embedding(self.ent_tot, self.dim_e)
 
 rel_embeddings = nn.Embedding(self.rel_tot, self.dim_r)
 
 ent_transfer = nn.Embedding(self.ent_tot, self.dim_e)
 
 rel_transfer = nn.Embedding(self.rel_tot, self.dim_r)
 
 ent_embedding_range
 
 rel_embedding_range
 
bool margin = False
 
bool margin_flag = True
 
- Public Attributes inherited from OpenKE.module.model.Model.Model
 ent_tot = ent_tot
 
 rel_tot = rel_tot
 
- Public Attributes inherited from OpenKE.module.BaseModule.BaseModule
 zero_const = nn.Parameter(torch.Tensor([0]))
 
 pi_const = nn.Parameter(torch.Tensor([3.14159265358979323846]))
 

Protected Member Functions

 _resize (self, tensor, axis, size)
 
 _calc (self, h, t, r, mode)
 
 _transfer (self, e, e_transfer, r_transfer)
 

Constructor & Destructor Documentation

◆ __init__()

OpenKE.module.model.TransD.TransD.__init__ ( self,
ent_tot,
rel_tot,
dim_e = 100,
dim_r = 100,
p_norm = 1,
norm_flag = True,
margin = None,
epsilon = None )

Reimplemented from OpenKE.module.model.Model.Model.

Member Function Documentation

◆ forward()

OpenKE.module.model.TransD.TransD.forward ( self,
data )

Reimplemented from OpenKE.module.model.Model.Model.

◆ predict()

OpenKE.module.model.TransD.TransD.predict ( self,
data )

Reimplemented from OpenKE.module.model.Model.Model.

Member Data Documentation

◆ ent_embedding_range

OpenKE.module.model.TransD.TransD.ent_embedding_range
Initial value:
= nn.Parameter(
torch.Tensor([(self.margin + self.epsilon) / self.dim_e]),
requires_grad=False,
)

◆ rel_embedding_range

OpenKE.module.model.TransD.TransD.rel_embedding_range
Initial value:
= nn.Parameter(
torch.Tensor([(self.margin + self.epsilon) / self.dim_r]),
requires_grad=False,
)

The documentation for this class was generated from the following file: