class_docstr: The RotatE model from the `"RotatE: Knowledge Graph Embedding by
  Relational Rotation in Complex Space" <https://arxiv.org/abs/
  1902.10197>`_ paper.
  
  :class:`RotatE` models relations as a rotation in complex space
  from head to tail such that
  
  .. math::
      \mathbf{e}_t = \mathbf{e}_h \circ \mathbf{e}_r,
  
  resulting in the scoring function
  
  .. math::
      d(h, r, t) = - {\| \mathbf{e}_h \circ \mathbf{e}_r - \mathbf{e}_t \|}_p
  
  .. note::
  
      For an example of using the :class:`RotatE` model, see
      `examples/kge_fb15k_237.py
      <https://github.com/pyg-team/pytorch_geometric/blob/master/examples/
      kge_fb15k_237.py>`_.
  
  Args:
      num_nodes (int): The number of nodes/entities in the graph.
      num_relations (int): The number of relations in the graph.
      hidden_channels (int): The hidden embedding size.
      margin (float, optional): The margin of the ranking loss.
      sparse (bool, optional): If set to :obj:`True`, gradients w.r.t. to
          the embedding matrices will be sparse. (default: :obj:`False`)
class_docstr_tok: ["The","RotatE","model","from","the","`","``","RotatE",":","Knowledge","Graph","Embedding","by","Relational","Rotation","in","Complex","Space","''","<","https",":","\/\/arxiv.org\/abs\/","1902.10197",">","`","_","paper",".",":","class",":","`","RotatE","`","models","relations","as","a","rotation","in","complex","space","from","head","to","tail","such","that","..","math",":",":","\\mathbf","{","e","}","_t","=","\\mathbf","{","e","}","_h","\\circ","\\mathbf","{","e","}","_r",",","resulting","in","the","scoring","function","..","math",":",":","d","(","h",",","r",",","t",")","=","-","{","\\|","\\mathbf","{","e","}","_h","\\circ","\\mathbf","{","e","}","_r","-","\\mathbf","{","e","}","_t","\\|","}","_p","..","note",":",":","For","an","example","of","using","the",":","class",":","`","RotatE","`","model",",","see","`","examples\/kge_fb15k_237.py","<","https",":","\/\/github.com\/pyg-team\/pytorch_geometric\/blob\/master\/examples\/","kge_fb15k_237.py",">","`","_",".","Args",":","num_nodes","(","int",")",":","The","number","of","nodes\/entities","in","the","graph",".","num_relations","(","int",")",":","The","number","of","relations","in","the","graph",".","hidden_channels","(","int",")",":","The","hidden","embedding","size",".","margin","(","float",",","optional",")",":","The","margin","of","the","ranking","loss",".","sparse","(","bool",",","optional",")",":","If","set","to",":","obj",":","`","True","`",",","gradients","w.r.t",".","to","the","embedding","matrices","will","be","sparse",".","(","default",":",":","obj",":","`","False","`",")"]
code: def __init__(
      self,
      num_nodes: int,
      num_relations: int,
      hidden_channels: int,
      margin: float = 1.0,
      sparse: bool = False,
  ):
      super().__init__(
          num_nodes, num_relations, hidden_channels, sparse
      )
  
      self.margin = margin
      self.node_emb_im = Embedding(
          num_nodes, hidden_channels, sparse=sparse
      )
  
      self.reset_parameters()
  
file_path: pytorch_geometric/torch_geometric/nn/kge/rotate.py
imports: import math
  import torch
  import torch.nn.functional
  from torch import Tensor
  from torch.nn import Embedding
  from torch_geometric.nn.kge import KGEModel
label_desc: Use image node_id 1 to create a new RotatE object from inherited base classes: KGEModel with example: obj = RotatE(num_nodes, num_relations, hidden_channels, margin, sparse)