wta hash function for torch