✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
What is the most efficient way to store the result res obtained by executing the function below, in a python list, arr, given that this function will be called iteratively?
@torch.enable_grad()
def computation(net: nn.Module, x: torch.Tensor):
res = net(x).mean()
return res