code: def _create_batched_dataset_initializers(
      self,
      interactions,
      user_features,
      item_features,
      user_batch_size=None,
  ):
      if user_batch_size is not None:
          # Raise exception if interactions and user_features aren't sparse matrices
          if (not sp.issparse(interactions)) or (
              not sp.issparse(user_features)
          ):
              raise BatchNonSparseInputException()
  
          # Coerce to CSR for fast batching
          if not isinstance(interactions, sp.csr_matrix):
              interactions = sp.csr_matrix(interactions)
          if not isinstance(user_features, sp.csr_matrix):
              user_features = sp.csr_matrix(user_features)
  
          n_users = user_features.shape[0]
  
          interactions_batched = []
          user_features_batched = []
  
          start_batch = 0
          while start_batch < n_users:
              # min() ensures that the batch bounds doesn't go past the end of the index
              end_batch = min(start_batch + user_batch_size, n_users)
  
              interactions_batched.append(
                  interactions[start_batch:end_batch]
              )
              user_features_batched.append(
                  user_features[start_batch:end_batch]
              )
  
              start_batch = end_batch
  
          # Overwrite the input with the new, batched input
          interactions = interactions_batched
          user_features = user_features_batched
  
      # TODO this is hand-wavy and begging for a cleaner refactor
      (int_ds, uf_ds, if_ds), (
          int_init,
          uf_init,
          if_init,
      ) = self._create_datasets_and_initializers(
          interactions=interactions,
          user_features=user_features,
          item_features=item_features,
      )
  
      # Ensure that lengths make sense
      if len(int_init) != len(uf_init):
          raise ValueError(
              "Number of batches in user_features and interactions must be equal."
          )
      if (len(if_init) > 1) and (len(if_init) != len(uf_init)):
          raise ValueError(
              "Number of batches in item_features must be 1 or equal to the number of batches in "
              "user_features."
          )
  
      # Cycle item features when zipping because there should only be one
      datasets = [ds_set for ds_set in zip(int_ds, uf_ds, cycle(if_ds))]
      initializers = [
          init_set
          for init_set in zip(int_init, uf_init, cycle(if_init))
      ]
  
      return datasets, initializers
  
imports: from functools import partial
  from itertools import cycle
  import logging
  import numpy
  import os
  import pickle
  from scipy import sparse
  import tensorflow
  from .errors import ModelNotBiasedException, ModelNotFitException, ModelWithoutAttentionException, BatchNonSparseInputException, TfVersionException
  from .input_utils import create_tensorrec_iterator, get_dimensions_from_tensorrec_dataset
  from .loss_graphs import AbstractLossGraph, RMSELossGraph
  from .prediction_graphs import AbstractPredictionGraph, DotProductPredictionGraph
  from .recommendation_graphs import project_biases, split_sparse_tensor_indices, bias_prediction_dense, bias_prediction_serial, rank_predictions, densify_sampled_item_predictions, collapse_mixture_of_tastes, predict_similar_items
  from .representation_graphs import AbstractRepresentationGraph, LinearRepresentationGraph
  from .session_management import get_session
  from .util import sample_items, calculate_batched_alpha, datasets_from_raw_input
label_desc: Use image node_id 5 for calling the TensorRec obj's underlying member method code with example usage: obj._create_batched_dataset_initializers(interactions, user_features, item_features, user_batch_size) and returns: datasets,  initializers