Rohit Rajpoot commited on
Commit
b802c7c
·
1 Parent(s): e042c07

Detach tensor before .numpy() in heatmap

Browse files
Files changed (1) hide show
  1. assist/heatmap.py +1 -1
assist/heatmap.py CHANGED
@@ -4,7 +4,7 @@ from sklearn.metrics.pairwise import cosine_similarity
4
 
5
  def show_heatmap(tensor_path="tensor.pt"):
6
  # Load embeddings
7
- weights = torch.load(tensor_path).numpy()
8
  # Compute similarity
9
  sim = cosine_similarity(weights)
10
  # Plot
 
4
 
5
  def show_heatmap(tensor_path="tensor.pt"):
6
  # Load embeddings
7
+ weights = torch.load(tensor_path).detach().numpy()
8
  # Compute similarity
9
  sim = cosine_similarity(weights)
10
  # Plot