Hi,
You should not modify a single Variable inplace multiple times.
In your case, one wait to solve this would be:
for i in range(k_clusters):
  # some code

  guess_img_dist_list = []
  for n in range(length):
    # some code
    guess_img_dist_list.append(torch.norm(...))

  guess_img_dist_arr = torch.cat(guess_img_dist_list, 0)