hash: added support for (torch) serialization
available only if torch is found