Home / Function/ __len__() — pytorch Function Reference

__len__() — pytorch Function Reference

Architecture documentation for the __len__() function in samplers_benchmark.py from the pytorch codebase.

Entity Profile

Relationship Graph

Source Code

benchmarks/data/samplers_benchmark.py lines 60–65

    def __len__(self) -> int:
        # Can only be called if self.sampler has __len__ implemented
        if self.drop_last:
            return len(self.sampler) // self.batch_size  # type: ignore[arg-type]
        else:
            return (len(self.sampler) + self.batch_size - 1) // self.batch_size  # type: ignore[arg-type]

Domain

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free