Special (dunder) methods: how do __getitem__, __len__ and __call__ power PyTorch?
Interview insights are lockedSee how often this is asked and which companies asked it with Buncho Pro.What are dunder (magic) methods?
- Which ones must a PyTorch map-style
Datasetimplement, and why? - What does
nn.Module.__call__do thatforwardalone does not? - Which dunder methods would you implement for a small
Vectorclass?