code: def compute_train_cv_probabilities(
      dir,
      iter,
      egs_dir,
      run_opts,
      get_raw_nnet_from_am=True,
      use_multitask_egs=False,
      compute_per_dim_accuracy=False,
  ):
      if get_raw_nnet_from_am:
          model = "{dir}/{iter}.mdl".format(dir=dir, iter=iter)
      else:
          model = "{dir}/{iter}.raw".format(dir=dir, iter=iter)
  
      scp_or_ark = "scp" if use_multitask_egs else "ark"
      egs_suffix = ".scp" if use_multitask_egs else ".egs"
      egs_rspecifier = "{0}:{1}/valid_diagnostic{2}".format(
          scp_or_ark, egs_dir, egs_suffix
      )
  
      opts = []
      if compute_per_dim_accuracy:
          opts.append("--compute-per-dim-accuracy")
  
      multitask_egs_opts = common_train_lib.get_multitask_egs_opts(
          egs_dir,
          egs_prefix="valid_diagnostic.",
          use_multitask_egs=use_multitask_egs,
      )
  
      common_lib.background_command(
          """ {command} {dir}/log/compute_prob_valid.{iter}.log \
                  nnet3-compute-prob "{model}" \
                  "ark,bg:nnet3-copy-egs {multitask_egs_opts} \
                      {egs_rspecifier} ark:- | \
                      nnet3-merge-egs --minibatch-size=1:64 ark:- \
                      ark:- |" """.format(
              command=run_opts.command,
              dir=dir,
              iter=iter,
              egs_rspecifier=egs_rspecifier,
              opts=" ".join(opts),
              model=model,
              multitask_egs_opts=multitask_egs_opts,
          )
      )
  
      egs_rspecifier = "{0}:{1}/train_diagnostic{2}".format(
          scp_or_ark, egs_dir, egs_suffix
      )
  
      multitask_egs_opts = common_train_lib.get_multitask_egs_opts(
          egs_dir,
          egs_prefix="train_diagnostic.",
          use_multitask_egs=use_multitask_egs,
      )
  
      common_lib.background_command(
          """{command} {dir}/log/compute_prob_train.{iter}.log \
                  nnet3-compute-prob {opts} "{model}" \
                  "ark,bg:nnet3-copy-egs {multitask_egs_opts} \
                      {egs_rspecifier} ark:- | \
                      nnet3-merge-egs --minibatch-size=1:64 ark:- \
                      ark:- |" """.format(
              command=run_opts.command,
              dir=dir,
              iter=iter,
              egs_rspecifier=egs_rspecifier,
              opts=" ".join(opts),
              model=model,
              multitask_egs_opts=multitask_egs_opts,
          )
      )
  
imports: from __future__ import print_function
  from __future__ import division
  import glob
  import logging
  import math
  import os
  import random
  import time
  import libs.common
  import libs.nnet3.train.common
label_desc: Use image node_id 4 for calling a global function with example usage: compute_train_cv_probabilities(dir, iter, egs_dir, run_opts, get_raw_nnet_from_am, use_multitask_egs, compute_per_dim_accuracy) without return types