docstr: Generate forward passes to determine the number of features when max_features is set.
docstr_tok: ["Generate","forward","passes","to","determine","the","number","of","features","when","max_features","is","set","."]
code: def _generate_scores(
      self, solver, xsub, ysub, step_size, feature_order
  ):
      """
      Generate forward passes to determine the number of features when max_features is set.
      """
      scores = []
      for i in np.arange(1, self.max_features + 1, step_size):
          # optimization possible since xsub is growing?
          i = int(np.ceil(i))
          # pylint: disable=E1102
          score = solver.f_train(
              torch.tensor(np.ones(i), dtype=torch.get_default_dtype())
              .unsqueeze(1)
              .to(self.device),
              xsub[:, feature_order[:i]],
              ysub,
          )
          if constants.Device.CUDA in score.device.type:
              score = score.cpu()
          # score.numpy()[0][0]
          scores.append(score)
      return scores
  
imports: import time
  import numpy
  import pandas
  from sklearn.base import BaseEstimator
  from sklearn.feature_selection import SelectorMixin
  from sklearn.utils.validation import check_is_fitted
  import torch
  from nni.feature_engineering.feature_selector import FeatureSelector
  from .None import constants
  from .fginitialize import PrepareData
  from .fgtrain import _train
label_desc: Use image node_id 18 for calling the FeatureGradientSelector obj's underlying member method code with example usage: obj._generate_scores(solver, xsub, ysub, step_size, feature_order) and returns: scores