original_docstring: 
      Define loss function for RMFE.
      
      :param model: model used for inference
      :param reg_weight: weight of regularization term
      :param criterion: criterion for supervised loss
      :param is_packed: packed for LSTM or not
      
docstring: Define loss function for RMFE.
docstring_tokens: Define loss function for RMFE .
code: def RMFE_object(reg_weight=1e-10, criterion=torch.nn.BCEWithLogitsLoss(), is_packed=False):
      """
      Define loss function for RMFE.
      
      :param model: model used for inference
      :param reg_weight: weight of regularization term
      :param criterion: criterion for supervised loss
      :param is_packed: packed for LSTM or not
      """
      def regfunc(pred, truth, args):
          model = args['model']
          lossfunc = RegularizationLoss(criterion, model, reg_weight, is_packed)
          ce_loss = _criterioning(pred, truth, criterion)
          inps = args['inputs']
          try:
              reg_loss = lossfunc(pred, [i.cuda() for i in inps])
          except RuntimeError:
              print("No reg loss for validation")
              reg_loss = 0
          return ce_loss+reg_loss
      return regfunc
code_tokens: def RMFE_object ( reg_weight = 1e-10 , criterion = torch . nn . BCEWithLogitsLoss ( ) , is_packed = False ) : def regfunc ( pred , truth , args ) : model = args [ 'model' ] lossfunc = RegularizationLoss ( criterion , model , reg_weight , is_packed ) ce_loss = _criterioning ( pred , truth , criterion ) inps = args [ 'inputs' ] try : reg_loss = lossfunc ( pred , [ i . cuda ( ) for i in inps ] ) except RuntimeError : print ( "No reg loss for validation" ) reg_loss = 0 return ce_loss + reg_loss return regfunc
short_docstring: Define loss function for RMFE.
short_docstring_tokens: Define loss function for RMFE .
comment: """
      Define loss function for RMFE.
      
      :param model: model used for inference
      :param reg_weight: weight of regularization term
      :param criterion: criterion for supervised loss
      :param is_packed: packed for LSTM or not
      """