code: def _run_on_loss(self, net, param_init_net, param, grad=None):
      # TODO: the second dim (num of input nodes) of param is after feature preproc,
      # and does not correspond to the original num of dense features.
      # In the future, will want to create a util to reduce the input dim of param to
      # match the num of dense features.
  
      output_blob = net.NextScopedBlob(
          param + "_dense_feature_regularization"
      )
      grouped_feature_weight_vec = self._feature_grouping(param, net)
  
      # compute approximate L0 norm
      # sum_i ( min ( abs (theta_i), alpha))) / alpha
      l0_abs = net.Abs(
          [grouped_feature_weight_vec], [net.NextScopedBlob("l0_abs")]
      )
      l0_min = net.Clip(
          [l0_abs], [net.NextScopedBlob("l0_min")], max=self.alpha
      )
      l0_summed = net.ReduceFrontSum(
          [l0_min], [net.NextScopedBlob("l0_summed")]
      )
      l0_norm = net.Scale(
          [l0_summed],
          [net.NextScopedBlob("l0_norm")],
          scale=(1 / self.alpha),
      )
  
      # incorporate budget factor
      # regularization = reg_lambda * max(0, l0_norm - budget)
      if self.budget:
          budget_blob = net.ConstantFill(
              [], "budget", shape=[1], value=self.budget
          )
          l0_sub_budget = net.Sub(
              [l0_norm, budget_blob], [net.NextScopedBlob("l0_budget")]
          )
          relu_l0_sub_budget = net.Relu(
              [l0_sub_budget],
              [net.NextScopedBlob("relu_l0_sub_budget")],
          )
          net.Scale(
              [relu_l0_sub_budget], [output_blob], scale=self.reg_lambda
          )
      else:
          net.Scale([l0_norm], [output_blob], scale=self.reg_lambda)
      return output_blob
  
imports: from caffe2.python import core, utils
  import numpy
label_desc: Use image node_id 2 for calling the L0ApproxNorm obj's underlying member method code with example usage: obj._run_on_loss(net, param_init_net, param, grad) and returns: output_blob