When comparing two tensors, the == operator compares the values of each element in the tensors, and if there is even one element that is not equal, it will return False.
exmaple)
cos_sim_value_1 == cos_sim_value_2 # not enough for comparison between two tensors
torch.allclose(cos_sim_value_1[0], cos_sim_value_2[0], atol=1e-5) # True, matrix multiplication causal
cos_sim_value_1[0][0], cos_sim_value_2[0][0]
# (tensor(0.8399), tensor(0.8399))
cos_sim_value_1[0][0].item(), cos_sim_value_2[0][0].item()
# (0.839893102645874, 0.8398933410644531)