フリー問題

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

問題文

A script must run unchanged on a workstation with a CUDA GPU and on a laptop with no accelerator. Which pattern for choosing the device is appropriate?

選択肢

  1. Set an environment variable and let the process decide.
  2. Hard-code the GPU device and catch the exception if it is missing.
  3. Query availability at startup and build a device object from the result, then pass that device to every tensor and module.
  4. Always construct tensors on the CPU and rely on the framework to migrate them to an accelerator at runtime.

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

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