torch.utils.bottleneck

Creator
Creator
Seonglae Cho
Created
Created
2024 Jun 1 1:55
Editor
Edited
Edited
2024 Jun 1 1:57
Refs
identify performance bottlenecks in your PyTorch code
import torch from torch.utils.bottleneck import bottleneck model = YourModelDefinition() inputs = torch.randn(batch_size, input_shape) with bottleneck(mode='full'): outputs = model(inputs) loss = loss_function(outputs) loss.backward() bottleneck.show_bottlenecks()
  • bottleneck.show_bottlenecks() display a report highlighting the most time-consuming operations in your PyTorch code
 
 
 
 
 
 
 
 

Recommendations