Skip to content

Compose of transformations for CacheDataset #6111

Description

@jfulem

The usage of compose of transformations with map_items = False is omitted

When using the CacheDataset the _load_cache_item method is called, but there the Compose.map_items is not used and therefore all the transformations are applied to all data even though the data is a list or tuple.

    def _load_cache_item(self, idx: int):
        """
        Args:
            idx: the index of the input data sequence.
        """
        item = self.data[idx]
        for _transform in self.transform.transforms:
            # execute all the deterministic transforms
            if isinstance(_transform, RandomizableTrait) or not isinstance(_transform, Transform):
                break
            _xform = deepcopy(_transform) if isinstance(_transform, ThreadUnsafe) else _transform
            item = apply_transform(_xform, item)
        if self.as_contiguous:
            item = convert_to_contiguous(item, memory_format=torch.contiguous_format)
        return item

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions