input: def Transpile(src_dir, dst_dir, model_filename, params_filename):
      """Transpile a model from source directory to destination directory.
      This function loads an inference model, applies the inference transpiler,
      and saves the optimized model to the destination directory.
      
      Example:
      >>> Transpile('/src', '/dst', 'model', 'params')
      Loading inference_program from  /src
      Saving the optimized inference_program to  /dst
      """
      place = fluid.CPUPlace()
      exe = fluid.Executor(place)
  
      inference_scope = fluid.core.Scope()
      with fluid.scope_guard(inference_scope):
          print "Loading inference_program from ", src_dir
          [inference_program, feed_target_names,
           fetch_targets] = fluid.io.load_inference_model(src_dir, exe, model_filename, params_filename)
  
          inference_transpiler_program = inference_program.clone()
          # NOTE: Applying the inference transpiler will change the inference_transpiler_program.
          t = fluid.InferenceTranspiler()
          # Under the with statement, inference_scope is the global scope.
          t.transpile(inference_transpiler_program, place)
  
          #print inference_transpiler_program
  
          print "Saving the optimized inference_program to ", dst_dir
          # There is a bug in fluid.io.save_inference_model, so we can use the following code instead.
          if not os.path.isdir(dst_dir):
              os.makedirs(dst_dir)
          model_path = os.path.join(dst_dir, model_filename)
          with open(model_path, "wb") as f:
              f.write(inference_transpiler_program.desc.serialize_to_string())
          fluid.io.save_persistables(exe, dst_dir, inference_transpiler_program, params_filename)
output:     
          place = fluid.CPUPlace()
          exe = fluid.Executor(place)
  
          inference_scope = fluid.core.Scope()
          with fluid.scope_guard(inference_scope):
              print "Loading inference_program from ", src_dir
              [inference_program, feed_target_names,
               fetch_targets] = fluid.io.load_inference_model(src_dir, exe, model_filename, params_filename)
  
              inference_transpiler_program = inference_program.clone()
              # NOTE: Applying the inference transpiler will change the inference_transpiler_program.
              t = fluid.InferenceTranspiler()
              # Under the with statement, inference_scope is the global scope.
              t.transpile(inference_transpiler_program, place)
  
              #print inference_transpiler_program
  
              print "Saving the optimized inference_program to ", dst_dir
              # There is a bug in fluid.io.save_inference_model, so we can use the following code instead.
              if not os.path.isdir(dst_dir):
                  os.makedirs(dst_dir)
              model_path = os.path.join(dst_dir, model_filename)
              with open(model_path, "wb") as f:
                  f.write(inference_transpiler_program.desc.serialize_to_string())
              fluid.io.save_persistables(exe, dst_dir, inference_transpiler_program, params_filename)
  