code: def generate_data_tensor(
      X, Y, batch_size, shuffle=True, num_threads=1, capacity=None
  ):
      # TODO: Add a way with no batch?
      # TODO: Set threads to #CPUs fo machine
      cr = None
      if capacity is None:
          capacity = batch_size * num_threads * 4
  
      if isinstance(X, tf.Tensor) and isinstance(Y, tf.Tensor):
          # Optional Image and Label Batching
          if shuffle:
              X, Y = tf.train.shuffle_batch(
                  [X, Y],
                  batch_size=batch_size,
                  min_after_dequeue=batch_size,
                  capacity=capacity,
                  num_threads=num_threads,
              )
          else:
              X, Y = tf.train.batch(
                  [X, Y],
                  batch_size=batch_size,
                  capacity=capacity,
                  num_threads=num_threads,
              )
  
      # Array Input
      elif X is not None and Y is not None:
          X_shape = list(np.shape(X))
          Y_shape = list(np.shape(Y))
          # Create a queue using feed_dicts
          cr = ArrayFlow(
              X,
              Y,
              batch_size=batch_size,
              shuffle=shuffle,
              capacity=capacity,
          )
          X, Y = cr.get()
          # Assign a shape to tensors
          X_reshape = (
              [-1] + X_shape[1:] if len(X_shape[1:]) > 0 else [-1, 1]
          )
          Y_reshape = (
              [-1] + Y_shape[1:] if len(Y_shape[1:]) > 0 else [-1, 1]
          )
          X = tf.reshape(X, X_reshape)
          Y = tf.reshape(Y, Y_reshape)
  
      return X, Y, cr
  
imports: from __future__ import division, print_function, absolute_import
  import numpy
  import threading
  import tensorflow.compat.v1
  from .None import utils
label_desc: Use image node_id 1 for calling a global function with example usage: generate_data_tensor(X, Y, batch_size, shuffle, num_threads, capacity) and returns: X,  Y,  cr