code: def predict(network, X, batch_size=None):
      """
      Return the predict results of given non time-series network.
  
      Parameters
      ----------
      network : TensorLayer Model
          The network.
      X : numpy.array
          The inputs.
      batch_size : int or None
          The batch size for prediction, when dataset is large, we should use minibatche for prediction;
          if dataset is small, we can set it to None.
  
      Examples
      --------
      See `tutorial_mnist_simple.py <https://github.com/tensorlayer/tensorlayer/blob/master/example/tutorial_mnist_simple.py>`_
  
      >>> _logits = tl.utils.predict(network, X_test)
      >>> y_pred = np.argmax(_logits, 1)
  
      """
      network.eval()
      if batch_size is None:
          y_pred = network(X)
          return y_pred
      else:
          result = None
          for X_a, _ in tl.iterate.minibatches(
              X, X, batch_size, shuffle=False
          ):
              result_a = network(X_a)
              if result is None:
                  result = result_a
              else:
                  result = np.concatenate((result, result_a))
          if result is None:
              if len(X) % batch_size == 0:
                  result_a = network(X[-(len(X) % batch_size) :, :])
                  result = result_a
          else:
              if len(X) != len(result) and len(X) % batch_size != 0:
                  result_a = network(X[-(len(X) % batch_size) :, :])
                  result = np.concatenate((result, result_a))
          return result
  
imports: import os
  import random
  import subprocess
  import sys
  import time
  from collections import Counter
  from sys import exit
  from sys import platform
  import numpy
  import tensorflow
  from sklearn.metrics import accuracy_score, confusion_matrix, f1_score
  import tensorlayer
label_desc: Use image node_id 3 for calling a global function with example usage: predict(network, X, batch_size) and returns: y_pred, result