hash: fix type handling with torch