class_docstr: An EGL variant that is restricted to the gradients of a single layer.
  
  This is a generalized version of the EGL-sm strategy [ZLW17]_, but instead of being
  restricted to the last layer it operates on the layer name passed to the constructor.
class_docstr_tok: ["An","EGL","variant","that","is","restricted","to","the","gradients","of","a","single","layer",".","This","is","a","generalized","version","of","the","EGL-sm","strategy","[","ZLW17","]","_",",","but","instead","of","being","restricted","to","the","last","layer","it","operates","on","the","layer","name","passed","to","the","constructor","."]
code: def compute_gradient_length(self, clf, sm, gradients, j, k):
      _assert_layer_exists(clf.model, self.layer_name)
  
      modules = dict(
          {name: module for name, module in clf.model.named_modules()}
      )
      params = [
          param.grad.flatten()
          for param in modules[self.layer_name].parameters()
          if param.requires_grad
      ]
      params = torch.cat(params)
  
      gradients[j, k] += torch.norm(params, 2)
      gradients[j, k] = gradients[j, k] * sm[k, j].item()
  
imports: import numpy
  from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
  from small_text.query_strategies import constraints, QueryStrategy, EmbeddingBasedQueryStrategy
  from small_text.utils.clustering import init_kmeans_plusplus_safe
  from small_text.utils.context import build_pbar_context
  from small_text.utils.data import list_length
label_desc: Use image node_id 2 for calling the ExpectedGradientLengthLayer obj's underlying member method code with example usage: obj.compute_gradient_length(clf, sm, gradients, j, k) without return types