class_docstr: A distance between neural networks based on solving a transportation problem. 
docstr: Adds the two matrices and adds an additional dummy layer at he end of the rows and
  columns. Also makes some synthetic changes to enable OT computation. 
docstr_tok: ["Adds","the","two","matrices","and","adds","an","additional","dummy","layer","at","he","end","of","the","rows","and","columns",".","Also","makes","some","synthetic","changes","to","enable","OT","computation","."]
code: def get_ot_cost_matrix(
      cls,
      mislabel_cost_matrix,
      struct_cost_matrix,
      mislabel_coeff,
      struct_coeff,
      non_assignment_penalty,
      replace_cost_inf_with=REPLACE_COST_INF_WITH,
  ):
      """Adds the two matrices and adds an additional dummy layer at he end of the rows and
      columns. Also makes some synthetic changes to enable OT computation.
      """
      # Add dummy layer
      cost_matrix = (
          mislabel_coeff * mislabel_cost_matrix
          + struct_coeff * struct_cost_matrix
      )
      row_add = non_assignment_penalty * np.ones(
          (1, cost_matrix.shape[1])
      )
      col_add = non_assignment_penalty * np.ones(
          (cost_matrix.shape[0] + 1, 1)
      )
      col_add[-1] = 0.0
      cost_matrix = np.vstack((cost_matrix, row_add))
      cost_matrix = np.hstack((cost_matrix, col_add))
      # Replace infinities with a large value.
      if replace_cost_inf_with is not None and np.isfinite(
          replace_cost_inf_with
      ):
          cost_matrix[
              np.logical_not(np.isfinite(cost_matrix))
          ] = replace_cost_inf_with
      return cost_matrix
  
imports: import numpy
  from .None import neural_network
  from ..gp.kernel import ExpSumOfDistsKernel, SumOfExpSumOfDistsKernel
  from ..utils.oper_utils import opt_transport
label_desc: Use image node_id 6 for calling the OTMANNDistanceComputer obj's underlying member method code with example usage: obj.get_ot_cost_matrix(cls, mislabel_cost_matrix, struct_cost_matrix, mislabel_coeff, struct_coeff, non_assignment_penalty, replace_cost_inf_with) and returns: cost_matrix