docstr: Run session for predicting with new batch of validation data (inputs, labels and weights) as well as test data (inputs)
  
  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 (in case of validation data)
      Probabilities (in case only inputs are provided)
docstr_tok: ["Run","session","for","predicting","with","new","batch","of","validation","data","(","inputs",",","labels","and","weights",")","as","well","as","test","data","(","inputs",")","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","(","in","case","of","validation","data",")","Probabilities","(","in","case","only","inputs","are","provided",")"]
code: def predict(self, feed_dict):
      """
      Run session for predicting with new batch of validation data (inputs, labels and weights) as well as test data (inputs)
  
      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 (in case of validation data)
          Probabilities (in case only inputs are provided)
      """
      # Convert input
      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],
              ),
          )
  
      # Generate predictions
      prob = self.model.predict(feed_dict["input"])
      probabilities = _np.reshape(
          prob, (prob.shape[0], prob.shape[1] * prob.shape[2])
      )
      result = {"output": probabilities}
  
      if "labels" in feed_dict.keys():  # Validation data?
          keras = _lazy_import_tensorflow().keras
          labels = keras.utils.to_categorical(
              feed_dict["labels"], num_classes=self.num_classes
          )
  
          loss = self.model.loss(y_true=labels, y_pred=prob)
          loss = keras.backend.get_value(loss)
  
          weights = feed_dict["weights"].reshape(loss.shape)
          loss = loss * weights
          loss = _np.sum(loss, axis=1)
  
          result["loss"] = loss
  
      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 3 for calling the ActivityTensorFlowModel obj's underlying member method code with example usage: obj.predict(feed_dict) and returns: result