フリー問題

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

問題文

A developer loads a NumPy array of features and wants a PyTorch tensor that shares the same underlying memory, so that no extra copy of a large array is made. Which call satisfies that requirement?

選択肢

  1. torch.from_numpy(array), which builds a tensor that shares memory with the array.
  2. torch.Tensor(array.shape), so a tensor of the same shape is allocated over the same buffer.
  3. torch.clone(array), which links the two objects so that a later write to either one is seen by both.
  4. torch.tensor(array), because the constructor is documented as the memory-sharing entry point for external array objects.

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

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