parameters: (model)
return_statement: return returns[0], tvmparams
docstring: Convert from coreml model into NNVM format.
  
      Parameters
      ----------
      model:
          coremltools.models.MLModel of a NeuralNetworkClassifier
  
      Returns
      -------
      sym : nnvm.Symbol
          Compatible nnvm symbol
  
      params : dict of str to tvm.NDArray
          The parameter dict to be used by nnvm
docstring_summary: Convert from coreml model into NNVM format.
docstring_tokens: Convert from coreml model into NNVM format .
function: def from_coreml(model):
      """Convert from coreml model into NNVM format.
  
      Parameters
      ----------
      model:
          coremltools.models.MLModel of a NeuralNetworkClassifier
  
      Returns
      -------
      sym : nnvm.Symbol
          Compatible nnvm symbol
  
      params : dict of str to tvm.NDArray
          The parameter dict to be used by nnvm
      """
      try:
          import coremltools as cm
      except ImportError:
          raise ImportError('The coremltools package must be installed')
  
      assert isinstance(model, cm.models.MLModel)
      spec = model.get_spec()
      modeltype = spec.WhichOneof('Type')
      assert modeltype in ['neuralNetworkClassifier', 'neuralNetwork', 'neuralNetworkRegressor']
      cc = getattr(spec, modeltype)
  
      symtab = SymbolTable()
      for i in spec.description.input:
          symtab.get_var(i.name, must_contain=False)
  
      for pp in cc.preprocessing:
          whichpp = pp.WhichOneof('preprocessor')
          ppmethod = getattr(pp, whichpp)
          # the NeuralNetworkImageScalar doesn't seem to have a featureName?
          if whichpp == 'scaler':
              for i in spec.description.input:
                  coreml_op_to_nnvm(ppmethod, i.name, i.name, symtab)
          else:
              coreml_op_to_nnvm(ppmethod, pp.featureName, pp.featureName, symtab)
  
      for l in cc.layers:
          layertype = l.WhichOneof('layer')
          layerop = getattr(l, layertype)
          assert len(l.output) == 1
          if len(l.input) == 1:
              coreml_op_to_nnvm(layerop, l.input[0], l.output[0], symtab)
          else:
              coreml_op_to_nnvm(layerop, list(l.input), l.output[0], symtab)
      returns = [symtab.get_var(i.name, must_contain=False) for i in spec.description.output]
      tvmparams = {k:tvm.nd.array(np.array(v, dtype=np.float32)) for k, v in symtab.params.items()}
      # for now return first output
      return returns[0], tvmparams
function_tokens: def from_coreml ( model ) : try : import coremltools as cm except ImportError : raise ImportError ( 'The coremltools package must be installed' ) assert isinstance ( model , cm . models . MLModel ) spec = model . get_spec ( ) modeltype = spec . WhichOneof ( 'Type' ) assert modeltype in [ 'neuralNetworkClassifier' , 'neuralNetwork' , 'neuralNetworkRegressor' ] cc = getattr ( spec , modeltype ) symtab = SymbolTable ( ) for i in spec . description . input : symtab . get_var ( i . name , must_contain = False ) for pp in cc . preprocessing : whichpp = pp . WhichOneof ( 'preprocessor' ) ppmethod = getattr ( pp , whichpp ) # the NeuralNetworkImageScalar doesn't seem to have a featureName? if whichpp == 'scaler' : for i in spec . description . input : coreml_op_to_nnvm ( ppmethod , i . name , i . name , symtab ) else : coreml_op_to_nnvm ( ppmethod , pp . featureName , pp . featureName , symtab ) for l in cc . layers : layertype = l . WhichOneof ( 'layer' ) layerop = getattr ( l , layertype ) assert len ( l . output ) == 1 if len ( l . input ) == 1 : coreml_op_to_nnvm ( layerop , l . input [ 0 ] , l . output [ 0 ] , symtab ) else : coreml_op_to_nnvm ( layerop , list ( l . input ) , l . output [ 0 ] , symtab ) returns = [ symtab . get_var ( i . name , must_contain = False ) for i in spec . description . output ] tvmparams = { k : tvm . nd . array ( np . array ( v , dtype = np . float32 ) ) for k , v in symtab . params . items ( ) } # for now return first output return returns [ 0 ] , tvmparams