(config, logits, preds)
Save the result of inference.
Save the result of inference.
Save the result of inference .
def save_infer_res(config, logits, preds):
  """Save the result of inference."""
  res_file = config["data"]["infer"]["res"]
  res_dir = os.path.dirname(res_file)
  if not os.path.exists(res_dir):
    os.makedirs(res_dir)
  logging.info("Save inference result to: {}".format(res_file))
  with open(res_file, "w") as in_f:
    for logit, pred in zip(logits, preds):
      in_f.write(" ".join(["{:.3f}".format(num) for num in logit]) +
                 "\t{}\n".format(pred))
def save_infer_res ( config , logits , preds ) : res_file = config [ "data" ] [ "infer" ] [ "res" ] res_dir = os . path . dirname ( res_file ) if not os . path . exists ( res_dir ) : os . makedirs ( res_dir ) logging . info ( "Save inference result to: {}" . format ( res_file ) ) with open ( res_file , "w" ) as in_f : for logit , pred in zip ( logits , preds ) : in_f . write ( " " . join ( [ "{:.3f}" . format ( num ) for num in logit ] ) + "\t{}\n" . format ( pred ) )