code: def test_b():
      # -- second by simply freezing them
      np.random.seed(0)
      torch.manual_seed(0)
  
      print("2", end="")
      mod = make_module_cls()()
  
      opt = torch.optim.SGD
      cb = skorch.callbacks.Freezer(
          ["sequential.{}.weight".format(i) for i in linear_idcs[:-1]]
          + ["sequential.{}.bias".format(i) for i in linear_idcs[:-1]]
      )
  
      net = skorch.NeuralNetClassifier(
          mod, verbose=0, optimizer=opt, callbacks=[cb]
      )
      net.fit(X, y)
  
      for i in linear_idcs[:-1]:
          assert not mod.sequential[i].weight.requires_grad
          assert not net.module_.sequential[i].weight.requires_grad
  
      rss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
      return (
          rss,
          net.history[-1, "valid_loss"],
          np.mean(net.history[:, "dur"]),
      )
  
file_path: skorch/examples/benchmarks/freezing.py
imports: from functools import partial
  import resource
  from multiprocessing import Process, Queue
  import torch
  import skorch
  import skorch.helper
  from skorch.toy import make_classifier
  import sklearn.datasets
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: test_b() and returns: rss,  net,  np