引導式測驗 · 硬 等級

torch.compile 與 PyTorch 2 圖形編譯測驗

了解 torch.compile 擷取和後端角色、圖形中斷、編譯開銷、形狀專業化和公平效能檢查。

相關引導路徑Torch 編譯 Pytorch 2
問題 1 的 8

What does torch.compile attempt to do with compatible PyTorch computation?

預覽每個問題8 問題

當您參加測驗時,就會出現答案和解釋。

  1. What does torch.compile attempt to do with compatible PyTorch computation?
    • Rewrite the model’s training labels
    • Guarantee the same speedup for every workload
    • Capture and compile compatible tensor operations for optimized execution
    • Replace the model’s objective function
  2. Which component commonly captures Python frames in PyTorch 2 compilation?
    • TorchInductor
    • TorchDynamo
    • TorchScript
    • 自動梯度
  3. What does TorchInductor commonly provide?
    • Python frame and graph capture
    • Optimizer state management
    • Data batching and shuffling
    • A compiler backend that generates optimized code
  4. Why can the first compiled call be slower than eager execution?
    • Tracing and compilation add work to the first call
    • The first call always uses a larger training batch
    • Graph capture removes GPU operations
    • The first output is not computed
  5. With the default partial-graph behavior, what can happen when part of execution cannot be captured?
    • The entire model necessarily raises an error
    • An uncaptured region may run eagerly before capture resumes
    • The unsupported operation is omitted from the output
    • The optimizer changes the learning rate automatically
  6. What can happen when input shapes change?
    • A guard failure may trigger another specialized compilation
    • All shapes are padded to one size automatically
    • The compiled model ignores future input shapes
    • A new dataset is created for each shape
  7. How should a team assess a claimed compile speedup?
    • Time only the first call and call it steady state
    • Ignore data loading and synchronization
    • Use different models and batches in each measurement
    • Compare warmed-up end-to-end performance on representative inputs
  8. What should be checked after enabling compilation for training?
    • Output and gradient agreement with eager execution
    • The compile log contains no warnings
    • Warm throughput is higher than eager mode
    • Peak memory is lower than eager mode