フリー問題

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

問題文

A developer needs a tensor that has the same values as an existing tensor but is excluded from gradient tracking, and they must not modify the original. Which expression is appropriate?

選択肢

  1. torch.no_grad(x), which marks the tensor as excluded from every graph built after that point.
  2. x.item(), which strips the graph information while keeping the tensor usable in later arithmetic.
  3. x.requires_grad_(False), which is the documented way to obtain a detached copy while leaving the original tensor untouched for the rest of the program.
  4. x.detach(), which returns a tensor sharing the data but detached from the graph.

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

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