フリー問題

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

問題文

A team stores a list of layers as self.layers = [nn.Linear(10, 10) for _ in range(3)] inside a module. The optimizer receives no parameters from those layers. What is the correct container?

選択肢

  1. nn.ModuleList, which registers the contained modules so their parameters are discovered.
  2. nn.Sequential, which is required for any collection of layers whose parameters must be found.
  3. A plain tuple instead of a list, because immutable containers are traversed when the framework collects the parameters of a module while mutable ones are skipped to avoid inconsistent state.
  4. A dictionary with string keys, and the framework walks it when it gathers the parameters of the module.

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

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