Qcert.NNRCMR.Optim.TNNRCMROptimizer



Section TNNRCMROptimizer.


  Definition trew_old_nnrcmr
             {fruntime:foreign_runtime} {fredop:foreign_reduce_op} {logger:optimizer_logger string nnrc}
             (l: nnrcmr) :=
    let inputs_loc := l.(mr_inputs_loc) in
    let chain :=
        List.map
          (fun mr
             let map :=
                 match mr.(mr_map) with
                 | MapDist (x, n)MapDist (x, trew_old n)
                 | MapDistFlatten (x, n)MapDistFlatten (x, trew_old n)
                 | MapScalar (x, n)MapScalar (x, trew_old n)
                 end
             in
             let reduce :=
                 match mr.(mr_reduce) with
                 | RedIdRedId
                 | RedCollect (x, n)RedCollect (x, trew_old n)
                 | RedOp opRedOp op
                 | RedSingletonRedSingleton
                 end
             in
             mkMR mr.(mr_input) mr.(mr_output) map reduce)
          l.(mr_chain)
    in
    let last :=
        let '((params, n), args) := l.(mr_last) in
        ((params, trew_old n), args)
    in
    mkMRChain
      inputs_loc
      chain
      last.

End TNNRCMROptimizer.