@John1231983; it isn’t time consuming if the GPU is enabled.
Usage example:
input1 = torch.randn(5, 7)
input2 = torch.randn(5, 7)

dist_mat  = cosine_distance_torch(input1, input2, 2.4)
print(dist_mat )