docstr: Retrieve weights from the TF model, convert to the format Core ML
  expects and store in a dictionary.
  
  Returns
  -------
  net_params : dict
      Dictionary of weights, where the key is the name of the
      layer (e.g. `drawing_conv0_weight`) and the value is the
      respective weight of type `numpy.ndarray`.
docstr_tok: ["Retrieve","weights","from","the","TF","model",",","convert","to","the","format","Core","ML","expects","and","store","in","a","dictionary",".","Returns","--","--","--","-","net_params",":","dict","Dictionary","of","weights",",","where","the","key","is","the","name","of","the","layer","(","e.g",".","`","drawing_conv0_weight","`",")","and","the","value","is","the","respective","weight","of","type","`","numpy.ndarray","`","."]
code: def export_weights(self):
      """
      Retrieve weights from the TF model, convert to the format Core ML
      expects and store in a dictionary.
  
      Returns
      -------
      net_params : dict
          Dictionary of weights, where the key is the name of the
          layer (e.g. `drawing_conv0_weight`) and the value is the
          respective weight of type `numpy.ndarray`.
      """
  
      net_params = {}
  
      _tf = _lazy_import_tensorflow()
      with self.dc_graph.as_default():
          layer_names = _tf.trainable_variables()
          layer_weights = self.sess.run(layer_names)
  
      for var, val in zip(layer_names, layer_weights):
          if "bias" in var.name:
              net_params.update({var.name.replace(":0", ""): val})
          else:
              if "dense" in var.name:
                  if "drawing_dense0_weight" in var.name:
                      """
                      To make output of TF pool3 (NHWC) compatible with CoreML (NCHW).
                      Decompose FC weights to NHWC. Transpose to NCHW. Reshape back to FC.
                      """
                      tf_576_128 = val
                      tf_576_128 = _np.reshape(
                          tf_576_128, (3, 3, 64, 128)
                      )
                      tf_576_128 = _np.transpose(
                          tf_576_128, (2, 0, 1, 3)
                      )
                      tf_576_128 = _np.reshape(tf_576_128, (576, 128))
                      net_params.update(
                          {
                              var.name.replace(":0", ""): _np.transpose(
                                  tf_576_128, (1, 0)
                              )
                          }
                      )
                  else:
                      net_params.update(
                          {
                              var.name.replace(":0", ""): val.transpose(
                                  1, 0
                              )
                          }
                      )
              else:
                  # np.transpose won't change the underlying memory layout
                  # but in turicreate we will force it.
                  net_params.update(
                      {
                          var.name.replace(
                              ":0", ""
                          ): _utils.convert_conv2d_tf_to_coreml(val)
                      }
                  )
  
      return net_params
  
file_path: turicreate/src/python/turicreate/toolkits/drawing_classifier/_tf_drawing_classifier.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import numpy
  from .._tf_model import TensorFlowModel
  import turicreate.toolkits._tf_utils
  from turicreate._deps.minimal_package import _minimal_package_import_check
label_desc: Use image node_id 6 for calling the DrawingClassifierTensorFlowModel obj's underlying member method code with example usage: obj.export_weights() and returns: net_params