You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Zips multiple mappings to an iterable of (k, (v1, v2, ..., vn)).
References
My use case:
DictEncoder is a torch module that stores a dict of modules and encodes data sample of dict[str, Tensor] by applying every module on the corresponding value in the given dict. Basically, every method was a dzip on (self, sample) so I wanted to abstract this away.
@bbayles Thanks for the reply, Your implementation does not produce the expected result, dzip is supposed to return all values in a tuple, but ChainMap only returns the first one:
It would be possible to implement dzip with map_reduce, but probably look bad and allocate all the map which actually was my reason for writing dzip as a generator.
Description
Zips multiple mappings to an iterable of (k, (v1, v2, ..., vn)).
References
My use case:
DictEncoder is a torch module that stores a dict of modules and encodes data sample of dict[str, Tensor] by applying every module on the corresponding value in the given dict. Basically, every method was a dzip on (self, sample) so I wanted to abstract this away.
Examples
Here is an example implementation:
The text was updated successfully, but these errors were encountered: