class_docstr: Initialize tensor with pretrained weights.
  
  Example usage:
  
  .. code-block::
  
      import torch
      from pykeen.pipeline import pipeline
      from pykeen.nn.init import PretrainedInitializer
  
      # this is usually loaded from somewhere else
      # the shape must match, as well as the entity-to-id mapping
      pretrained_embedding_tensor = torch.rand(14, 128)
  
      result = pipeline(
          dataset="nations",
          model="transe",
          model_kwargs=dict(
              embedding_dim=pretrained_embedding_tensor.shape[-1],
              entity_initializer=PretrainedInitializer(tensor=pretrained_embedding_tensor),
          ),
      )
class_docstr_tok: ["Initialize","tensor","with","pretrained","weights",".","Example","usage",":","..","code-block",":",":","import","torch","from","pykeen.pipeline","import","pipeline","from","pykeen.nn.init","import","PretrainedInitializer","#","this","is","usually","loaded","from","somewhere","else","#","the","shape","must","match",",","as","well","as","the","entity-to-id","mapping","pretrained_embedding_tensor","=","torch.rand","(","14",",","128",")","result","=","pipeline","(","dataset=","''","nations","''",",","model=","''","transe","''",",","model_kwargs=dict","(","embedding_dim=pretrained_embedding_tensor.shape","[","-1","]",",","entity_initializer=PretrainedInitializer","(","tensor=pretrained_embedding_tensor",")",",",")",",",")"]
docstr: Initialize the initializer.
  
  :param tensor:
      the tensor of pretrained embeddings.
docstr_tok: ["Initialize","the","initializer",".",":","param","tensor",":","the","tensor","of","pretrained","embeddings","."]
code: def __init__(self, tensor: torch.FloatTensor) -> None:
      """
      Initialize the initializer.
  
      :param tensor:
          the tensor of pretrained embeddings.
      """
      self.tensor = tensor
  
imports: import functools
  import logging
  import math
  from typing import Any, Optional, Sequence
  import numpy
  import torch
  import torch.nn
  import torch.nn.init
  import torch_ppr.utils
  from class_resolver import FunctionResolver, Hint, HintOrType, OptionalKwargs
  from more_itertools import last
  from torch.nn import functional
  from .text import TextEncoder, text_encoder_resolver
  from .utils import iter_matrix_power, safe_diagonal
  from ..triples import CoreTriplesFactory, TriplesFactory
  from ..typing import Initializer, MappedTriples, OneOrSequence
  from ..utils import compose, get_edge_index, iter_weisfeiler_lehman, upgrade_to_sequence
label_desc: Use image node_id 1 to create a new PretrainedInitializer object  with example: obj = PretrainedInitializer(tensor)