class_docstr: Configuration options for the training of the Profet meta-model.
class_docstr_tok: ["Configuration","options","for","the","training","of","the","Profet","meta-model","."]
docstr: Retrieve a network with sampled weights for the given task id.
  
  Parameters
  ----------
  model : Bohamiann
      "Base" Bohamiann model used to get a network and its weights.
  size : int
      Input dimensions for the generated network.
  idx : int, optional
      Task idx, by default 0
  
  Returns
  -------
  nn.Module
      A module with sampled weights.
docstr_tok: ["Retrieve","a","network","with","sampled","weights","for","the","given","task","id",".","Parameters","--","--","--","--","--","model",":","Bohamiann","``","Base","''","Bohamiann","model","used","to","get","a","network","and","its","weights",".","size",":","int","Input","dimensions","for","the","generated","network",".","idx",":","int",",","optional","Task","idx",",","by","default","0","Returns","--","--","--","-","nn.Module","A","module","with","sampled","weights","."]
code: def _create_task_network(
      self, model, size: int, idx: int = 0
  ) -> "torch.nn.Module":
      """Retrieve a network with sampled weights for the given task id.
  
      Parameters
      ----------
      model : Bohamiann
          "Base" Bohamiann model used to get a network and its weights.
      size : int
          Input dimensions for the generated network.
      idx : int, optional
          Task idx, by default 0
  
      Returns
      -------
      nn.Module
          A module with sampled weights.
      """
      net = model.get_network(size)
      # assert False, (type(self).get_architecture, net, self.shapes)
      with torch.no_grad():
          sampled_weights = model.sampled_weights[idx]
          for parameter, sample in zip(
              net.parameters(), sampled_weights
          ):
              parameter.copy_(torch.from_numpy(sample))
      return net
  
imports: import json
  import pickle
  import warnings
  from abc import ABC
  from copy import deepcopy
  from dataclasses import dataclass
  from logging import getLogger
  from pathlib import Path
  from typing import Any, Callable, ClassVar, Optional, Tuple, Union
  import numpy
label_desc: Use image node_id 7 for calling the MetaModelConfig obj's underlying member method code with example usage: obj._create_task_network(model, size, idx) and returns: net