docstr: Run session for training with new batch of data (inputs, labels and weights)
  
  Parameters
  ----------
  feed_dict: Dictionary
      Dictionary to store a batch of input data, corresponding labels and weights. This is currently
      passed from the ac_data_iterator.cpp file when a new batch of data is sent.
  
  Returns
  -------
  result: Dictionary
      Loss per batch and probabilities
docstr_tok: ["Run","session","for","training","with","new","batch","of","data","(","inputs",",","labels","and","weights",")","Parameters","--","--","--","--","--","feed_dict",":","Dictionary","Dictionary","to","store","a","batch","of","input","data",",","corresponding","labels","and","weights",".","This","is","currently","passed","from","the","ac_data_iterator.cpp","file","when","a","new","batch","of","data","is","sent",".","Returns","--","--","--","-","result",":","Dictionary","Loss","per","batch","and","probabilities"]
code: def train(self, feed_dict):
      """
      Run session for training with new batch of data (inputs, labels and weights)
  
      Parameters
      ----------
      feed_dict: Dictionary
          Dictionary to store a batch of input data, corresponding labels and weights. This is currently
          passed from the ac_data_iterator.cpp file when a new batch of data is sent.
  
      Returns
      -------
      result: Dictionary
          Loss per batch and probabilities
      """
      for key in feed_dict.keys():
          feed_dict[key] = _utils.convert_shared_float_array_to_numpy(
              feed_dict[key]
          )
          feed_dict[key] = _np.squeeze(feed_dict[key], axis=1)
          feed_dict[key] = _np.reshape(
              feed_dict[key],
              (
                  feed_dict[key].shape[0],
                  feed_dict[key].shape[1],
                  feed_dict[key].shape[2],
              ),
          )
  
      keras = _lazy_import_tensorflow().keras
      loss = self.model.train_on_batch(
          x=feed_dict["input"],
          y=keras.utils.to_categorical(
              feed_dict["labels"], num_classes=self.num_classes
          ),
          sample_weight=_np.reshape(
              feed_dict["weights"], (self.batch_size, 20)
          ),
      )
  
      prob = self.model.predict(feed_dict["input"])
      probabilities = _np.reshape(
          prob, (prob.shape[0], prob.shape[1] * prob.shape[2])
      )
  
      result = {
          "loss": _np.array(loss),
          "output": _np.array(probabilities),
      }
      return result
  
file_path: turicreate/src/python/turicreate/toolkits/activity_classifier/_tf_model_architecture.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import turicreate.toolkits._tf_utils
  from .._tf_model import TensorFlowModel
  import numpy
  from turicreate._deps.minimal_package import _minimal_package_import_check
label_desc: Use image node_id 2 for calling the ActivityTensorFlowModel obj's underlying member method code with example usage: obj.train(feed_dict) and returns: result