class_docstr: The Trimmed Lasso: Sparsity and Robustness. https://arxiv.org/abs/1708.04527
class_docstr_tok: ["The","Trimmed","Lasso",":","Sparsity","and","Robustness",".","https",":","\/\/arxiv.org\/abs\/1708.04527"]
code: def _run_on_loss(self, net, param_init_net, param, grad=None):
      output_blob = net.NextScopedBlob(
          param + "_l1_trimmed_regularization"
      )
      abs = net.Abs([param], [net.NextScopedBlob("abs")])
      sum_abs = net.SumElements(
          [abs], [net.NextScopedBlob("sum_abs")], average=False
      )
      topk, _, _ = net.TopK(
          [abs],
          [
              net.NextScopedBlob("topk"),
              net.NextScopedBlob("id"),
              net.NextScopedBlob("flat_id"),
          ],
          k=self.k,
      )
      topk_sum = net.SumElements(
          [topk], [net.NextScopedBlob("topk_sum")], average=False
      )
      net.Sub([sum_abs, topk_sum], [output_blob])
      net.Scale([output_blob], [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 L1NormTrimmed obj's underlying member method code with example usage: obj._run_on_loss(net, param_init_net, param, grad) and returns: output_blob