code: def sample_items(n_items, n_users, n_sampled_items, replace):
      items_per_user = [
          np.random.choice(
              a=n_items, size=n_sampled_items, replace=replace
          )
          for _ in range(n_users)
      ]
  
      sample_indices = []
      for user, users_items in enumerate(items_per_user):
          for item in users_items:
              sample_indices.append((user, item))
  
      return np.array(sample_indices, np.int64)
  
imports: import math
  import numpy
  import random
  import scipy.sparse
  import six
  import tensorflow
  from weakref import WeakKeyDictionary
  from .input_utils import create_tensorrec_dataset_from_sparse_matrix, create_tensorrec_dataset_from_tfrecord
label_desc: Use image node_id 1 for calling a global function with example usage: sample_items(n_items, n_users, n_sampled_items, replace) and returns: np