original_docstring: 
      Gain bnn_with_loss, which wraps bnn network with loss function and kl loss of each bayesian layer.
  
      Args:
          layer_count (int): The number of kl loss to be generated, namely the number of Bayesian layers.
          backbone (Cell): The target network to wrap.
          loss_fn (Cell): The loss function used to compute loss.
          dnn_factor (int, float): The coefficient of backbone's loss, which is computed by loss function.
          bnn_factor (int, float): The coefficient of kl loss, which is kl divergence of Bayesian layer.
      
docstring: Gain bnn_with_loss, which wraps bnn network with loss function and kl loss of each bayesian layer.
docstring_tokens: Gain bnn_with_loss which wraps bnn network with loss function and kl loss of each bayesian layer .
code: def gain_bnn_with_loss(layer_count, backbone, loss_fn, dnn_factor, bnn_factor):
      """
      Gain bnn_with_loss, which wraps bnn network with loss function and kl loss of each bayesian layer.
  
      Args:
          layer_count (int): The number of kl loss to be generated, namely the number of Bayesian layers.
          backbone (Cell): The target network to wrap.
          loss_fn (Cell): The loss function used to compute loss.
          dnn_factor (int, float): The coefficient of backbone's loss, which is computed by loss function.
          bnn_factor (int, float): The coefficient of kl loss, which is kl divergence of Bayesian layer.
      """
      bnn_loss_func = _generate_kl_loss_func(layer_count)
      path = os.path.dirname(mindspore.__file__)
      bnn_loss_file = tempfile.NamedTemporaryFile(mode='w+t', suffix='.py', delete=True,
                                                  dir=path + '/nn/probability/transforms/bnn_loss')
      bnn_loss_file.write(bnn_loss_func)
      bnn_loss_file.seek(0)
  
      sys.path.append(path + '/nn/probability/transforms/bnn_loss')
  
      module_name = os.path.basename(bnn_loss_file.name)[0:-3]
      bnn_loss_module = importlib.import_module(module_name, __package__)
      bnn_with_loss = bnn_loss_module.WithBNNLossCell(backbone, loss_fn, dnn_factor, bnn_factor)
      return bnn_with_loss, bnn_loss_file
code_tokens: def gain_bnn_with_loss ( layer_count , backbone , loss_fn , dnn_factor , bnn_factor ) : bnn_loss_func = _generate_kl_loss_func ( layer_count ) path = os . path . dirname ( mindspore . __file__ ) bnn_loss_file = tempfile . NamedTemporaryFile ( mode = 'w+t' , suffix = '.py' , delete = True , dir = path + '/nn/probability/transforms/bnn_loss' ) bnn_loss_file . write ( bnn_loss_func ) bnn_loss_file . seek ( 0 ) sys . path . append ( path + '/nn/probability/transforms/bnn_loss' ) module_name = os . path . basename ( bnn_loss_file . name ) [ 0 : - 3 ] bnn_loss_module = importlib . import_module ( module_name , __package__ ) bnn_with_loss = bnn_loss_module . WithBNNLossCell ( backbone , loss_fn , dnn_factor , bnn_factor ) return bnn_with_loss , bnn_loss_file
short_docstring: Gain bnn_with_loss, which wraps bnn network with loss function and kl loss of each bayesian layer.
short_docstring_tokens: Gain bnn_with_loss which wraps bnn network with loss function and kl loss of each bayesian layer .
comment: """
      Gain bnn_with_loss, which wraps bnn network with loss function and kl loss of each bayesian layer.
  
      Args:
          layer_count (int): The number of kl loss to be generated, namely the number of Bayesian layers.
          backbone (Cell): The target network to wrap.
          loss_fn (Cell): The loss function used to compute loss.
          dnn_factor (int, float): The coefficient of backbone's loss, which is computed by loss function.
          bnn_factor (int, float): The coefficient of kl loss, which is kl divergence of Bayesian layer.
      """