docstr: x : B x D , feature embeddings
  return
      A: B x B the approximated rank matrix
docstr_tok: ["x",":","B","x","D",",","feature","embeddings","return","A",":","B","x","B","the","approximated","rank","matrix"]
code: def get_Matrix(self, x):
      """
      x : B x D , feature embeddings
      return
          A: B x B the approximated rank matrix
      """
      # Removed x = x.cuda() to avoid errors
  
      # Construct Affinity matrix
      W = pairwise_similarity(x)
      # Gaussian kernel
      W = torch.exp(
          W / 0.5
      )  # Increased variance from 0.05 to 0.5 in order to account for dtype Half in our code
  
      Y = torch.eye(
          len(W), dtype=W.dtype, device=x.device
      )  # Added dtype and device cast to avoid errors
  
      ## Set diagonal to 0 ?????
      W = W - W * Y
      D = torch.diag(torch.pow(torch.sum(W, dim=1), -0.5))
      D[D == float("Inf")] = 0.0
      S = torch.mm(torch.mm(D, W), D)  # Removed .cuda() to avoid errors
  
      # Solve random walk closed form
      dt = S.dtype
      L = torch.inverse(
          Y.float() - self.alpha * S.float()
      )  # Added dtype cast to avoid errors
      L = L.to(dt)
      A = (1 - self.alpha) * torch.mm(L, Y)
      return A
  
file_path: pytorch-metric-learning/tests/losses/test_manifold_loss.py
imports: import unittest
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.nn.modules.module import Module
  from pytorch_metric_learning.losses import ManifoldLoss
  from ..None import TEST_DEVICE, TEST_DTYPES
label_desc: Use image node_id 2 for calling the OriginalImplementationManifoldLoss obj's underlying member method code with example usage: obj.get_Matrix(x) and returns: A