code: def _get_used_params_mask(model, inputs, output_selector=None):
      selector = (
          (lambda x: x) if output_selector is None else output_selector
      )
      loss = selector(model(inputs)).sum().pow(2)
      grads = torch.autograd.grad(
          loss, model.parameters(), allow_unused=True
      )
      mask = [g is not None for g in grads]
      return mask
  
imports: import unittest
  from parameterized import parameterized
  import torch
  from torch import nn
  import higher
label_desc: Use image node_id 1 for calling a global function with example usage: _get_used_params_mask(model, inputs, output_selector) and returns: mask