code: def row_to_sample(row, column_info, model_type="wide_n_deep"):
      """
      convert a row to sample given column feature information of a WideAndDeep model
  
      :param row: Row of userId, itemId, features and label
      :param column_info: ColumnFeatureInfo specify information of different features
      :return: TensorSample as input for WideAndDeep model
      """
  
      wide_tensor = get_wide_tensor(row, column_info)
      deep_tensor = get_deep_tensors(row, column_info)
      deep_tensors = [JTensor.from_ndarray(ele) for ele in deep_tensor]
      label = row[column_info.label]
      model_type = model_type.lower()
      if model_type == "wide_n_deep":
          feature = [wide_tensor] + deep_tensors
      elif model_type == "wide":
          feature = wide_tensor
      elif model_type == "deep":
          feature = deep_tensors
      else:
          raise TypeError("Unsupported model_type: %s" % model_type)
      return Sample.from_jtensor(feature, label)
  
file_path: analytics-zoo/pyzoo/zoo/models/recommendation/utils.py
imports: import numpy
  from bigdl.util.common import JTensor, Sample
  from zoo.common.utils import callZooFunc
  from zoo.models.recommendation import UserItemFeature
label_desc: Use image node_id 7 for calling a global function with example usage: row_to_sample(row, column_info, model_type) and returns: Sample