class_docstr: A `BatchLoader` that zero-pads the graphs before iterating over the dataset.
  This means that `n_max` is computed over the whole dataset and not just
  a single batch.
  
  While using more memory than `BatchLoader`, this loader should reduce the
  computational overhead of padding each batch independently.
  
  Use this loader if:
  
  - memory usage isn't an issue and you want to produce the batches as fast
  as possible;
  - the graphs in the dataset have similar sizes and there are no outliers in
  the dataset (i.e., anomalous graphs with many more nodes than the dataset
  average).
  
  **Arguments**
  
  - `dataset`: a graph Dataset;
  - `mask`: bool, whether to add a mask to the node features;
  - `batch_size`: int, size of the mini-batches;
  - `epochs`: int, number of epochs to iterate over the dataset. By default (`None`)
  iterates indefinitely;
  - `shuffle`: bool, whether to shuffle the data at the start of each epoch;
  - `node_level`: bool, if `True` pad the labels along the node dimension;
  
  **Output**
  
  For each batch, returns a tuple `(inputs, labels)`.
  
  `inputs` is a tuple containing:
  
  - `x`: node attributes of shape `[batch, n_max, n_node_features]`;
  - `a`: adjacency matrices of shape `[batch, n_max, n_max]`;
  - `e`: edge attributes of shape `[batch, n_max, n_max, n_edge_features]`.
  
  `labels` have shape `[batch, n_labels]` if `node_level=False` or
  `[batch, n_max, n_labels]` otherwise.
code: def collate(self, batch):
      if len(batch) == 2:
          # If there is only one input, i.e., batch = [x, y], we unpack it
          # like this because Keras does not support input lists with only
          # one tensor.
          return batch[0], batch[1]
      else:
          return batch[:-1], batch[-1]
  
imports: import numpy
  import tensorflow
  from spektral.data.utils import batch_generator, collate_labels_batch, collate_labels_disjoint, get_spec, prepend_none, sp_matrices_to_sp_tensors, to_batch, to_disjoint, to_mixed, to_tf_signature
label_desc: Use image node_id 2 for calling the PackedBatchLoader obj's underlying member method code with example usage: obj.collate(batch) and returns: batch,  batch, batch,  batch