フリー問題

PyTorch Certified Associate のフリー問題 6 / 20 問目

問題文

A monitoring routine appends the current loss to a Python list every iteration by writing history.append(loss). After a few hundred iterations the process runs out of memory. What is the most likely cause and the fix?

選択肢

  1. The optimizer keeps a copy of every loss it has seen.
  2. Python lists are documented to copy tensors into a new device allocation each time an element is appended, so the memory grows with the number of appends even when the graph has already been released.
  3. The stored tensors still reference the graph that produced them, so appending loss.item() instead keeps only the number.
  4. The loss tensor grows in size every iteration.

解答・解説を確認するには

正解と解説の確認、回答の記録には無料登録が必要です。登録すると演習モードでフリー問題に回答し、正誤と解説をその場で確認できます。