class_docstr: Adapt Caffe prototxt and weights into uniform format
class_docstr_tok: ["Adapt","Caffe","prototxt","and","weights","into","uniform","format"]
code: def _adapt_parameter_data(self):
      sys.stdout.write("start parameter loading...\n")
      start_time = time.time()
      caffe_impl = caffeimpl.CaffeResolver()
      if caffe_impl.runtime():
          paras = caffe_impl.caffe.Net(
              self._source_solver.model_path,
              self._source_solver.weights_path,
              caffe_impl.caffe.TEST,
          ).params
          caffe_blobs = [
              (layer_name, map(lambda blobs: blobs.data, blob_vec))
              for layer_name, blob_vec in paras.items()
          ]
      else:
          sys.stdout.write(
              "loading weights via protopb, may take longer time than runtime"
          )
          params = caffe_impl.net()
          params.MergeFromString(
              open(self._source_solver.weights_path, "rb").read()
          )
          params_layers = params.layer or params.layers
          caffe_blobs = [
              (layer.name, [blob.data for blob in layer.blobs])
              for layer in params_layers
              if layer.blobs
          ]
      sys.stdout.write(
          "finished loading, total time: %d\n"
          % (time.time() - start_time)
      )
  
      # mapping the script into layers
      sys.stdout.write("start parameter matching...\n")
      for caffe_blob in caffe_blobs:
          try:
              cntk_layer = self._uni_model.cntk_layers[caffe_blob[0]]
          except KeyError:
              caffe_layers = self._raw_net.layer or self._raw_net.layers
              try:
                  special_layer = [
                      layer
                      for layer in caffe_layers
                      if layer.name == caffe_blob[0]
                  ][0]
                  if special_layer.type == "Scale":
                      previous_layer = [
                          caffe_layers[i - 1]
                          for i in range(len(caffe_layers))
                          if caffe_layers[i] == special_layer
                      ][0]
                      if previous_layer.type != "BatchNorm":
                          raise AssertionError(
                              "un-support pure Scale layer without BN in %s"
                              % caffe_layers.name
                          )
                      cntk_layer = self._uni_model.cntk_layers[
                          previous_layer.name
                      ]
                  else:
                      raise AssertionError(
                          "un-match layer name %s while matching parameters\n"
                          % caffe_blob.name
                      )
              except IndexError:
                  sys.stderr.write(
                      "ignore weights for %s, since not contained in graph\n"
                      % caffe_blob[0]
                  )
          for blob in caffe_blob[1]:
              cntk_parameter_tensor = cntkmodel.CntkTensorDefinition()
              cntk_parameter_tensor.data = blob
              cntk_layer.parameter_tensor.append(cntk_parameter_tensor)
      sys.stdout.write("finished matching.\n")
  
imports: import sys
  import os
  import time
  import math
  from cntk.contrib.crosstalkcaffe.unimodel import cntkmodel
  from cntk.contrib.crosstalkcaffe.adapter import baseadapter
  from .None import caffeimpl
label_desc: Use image node_id 6 for calling the CaffeAdapter obj's underlying member method code with example usage: obj._adapt_parameter_data() without return types