code: def _gl_transform(estimators, X, method, pb):
      """Transform the dataset.
  
      This will apply each estimator to all slices of the data.
  
      Parameters
      ----------
      X : array, shape (n_samples, nd_features, n_slices)
          The training input samples. For each data slice, a clone estimator
          is fitted independently. The feature dimension can be multidimensional
          e.g. X.shape = (n_samples, n_features_1, n_features_2, n_estimators)
      method : str
          The method to call for each estimator.
      pb : instance of ProgressBar
          The progress bar to update.
  
      Returns
      -------
      Xt : array, shape (n_samples, n_slices)
          The transformed values generated by each estimator.
      """
      n_sample, n_iter = X.shape[0], X.shape[-1]
      for ii, est in enumerate(estimators):
          # stack generalized data for faster prediction
          X_stack = X.transpose(
              np.r_[0, X.ndim - 1, range(1, X.ndim - 1)]
          )
          X_stack = X_stack.reshape(
              np.r_[n_sample * n_iter, X_stack.shape[2:]]
          )
          transform = getattr(est, method)
          _y_pred = transform(X_stack)
          # unstack generalizations
          if _y_pred.ndim == 2:
              _y_pred = np.reshape(
                  _y_pred, [n_sample, n_iter, _y_pred.shape[1]]
              )
          else:
              shape = np.r_[n_sample, n_iter, _y_pred.shape[1:]].astype(
                  int
              )
              _y_pred = np.reshape(_y_pred, shape)
          # Initialize array of predictions on the first transform iteration
          if ii == 0:
              y_pred = _gl_init_pred(_y_pred, X, len(estimators))
          y_pred[:, ii, ...] = _y_pred
  
          pb.update((ii + 1) * n_iter)
      return y_pred
  
imports: import logging
  import numpy
  from ..fixes import _get_check_scoring
  from ..parallel import parallel_func
  from ..utils import ProgressBar, _parse_verbose, array_split_idx, fill_doc, verbose
  from .base import BaseEstimator, _check_estimator
  from .mixin import TransformerMixin
label_desc: Use image node_id 6 for calling a global function with example usage: _gl_transform(estimators, X, method, pb) and returns: y_pred