class_docstr: This class is to speedup the model with provided weight mask, the masked module will be replaced by a new dense module.
  ModelSpeedup use concrete trace based on ``torch.fx`` to get the graph,
  note that the trace may fail if there is stochastic structure in the model.
  
  Parameters
  ----------
  model
      The model user wants to speedup.
  dummy_input
      A tensor or a tuple, the dummy input to execute the model.
  masks_or_file
      The path of user provided masks file, or the masks object.
  map_location
      The device on which masks are placed, same to map_location in ```torch.load```.
  batch_dim
      The index of batch dimension in the dummy_input.
  batch_size
      The batch_size coefficient of the sparsity inference.
      This value is actually used as the batchsize of the dummy_input.
  customized_mask_updaters
      A list of ``MaskUpdater``.
      NNI will automatically infer sparsity based on the data distribution in the forward and backward process,
      but if some special operations lead to automatic sparsity inference errors,
      users can manually set the mask inference rules for the special operations to make the mask inference correct.
  customized_replacers
      A list of ``Replacer``.
      The replacer is used to replace the origin module with a compressed module.
      Users can costomized the replacement logic by customized a replacer.
      Before the built-in replacement logic in nni is executed,
      the replacement logic in the customized replacer list will be executed sequentially first.
  graph_module
      A torch.fx.GraphModule.
      If ModelSpeedup default concrete trace cannot meet the needs,
      users can directly pass in a torch.fx.GraphModule instead.
  garbage_collect_values
      If the garbage_collect_values is True, nni will delete cache information after the cache has none usage.
  logger
      Set a logger. If the value is None, nni will use the default logger.
class_docstr_tok: ["This","class","is","to","speedup","the","model","with","provided","weight","mask",",","the","masked","module","will","be","replaced","by","a","new","dense","module",".","ModelSpeedup","use","concrete","trace","based","on","``","torch.fx","``","to","get","the","graph",",","note","that","the","trace","may","fail","if","there","is","stochastic","structure","in","the","model",".","Parameters","--","--","--","--","--","model","The","model","user","wants","to","speedup",".","dummy_input","A","tensor","or","a","tuple",",","the","dummy","input","to","execute","the","model",".","masks_or_file","The","path","of","user","provided","masks","file",",","or","the","masks","object",".","map_location","The","device","on","which","masks","are","placed",",","same","to","map_location","in","``","`","torch.load","``","`",".","batch_dim","The","index","of","batch","dimension","in","the","dummy_input",".","batch_size","The","batch_size","coefficient","of","the","sparsity","inference",".","This","value","is","actually","used","as","the","batchsize","of","the","dummy_input",".","customized_mask_updaters","A","list","of","``","MaskUpdater","``",".","NNI","will","automatically","infer","sparsity","based","on","the","data","distribution","in","the","forward","and","backward","process",",","but","if","some","special","operations","lead","to","automatic","sparsity","inference","errors",",","users","can","manually","set","the","mask","inference","rules","for","the","special","operations","to","make","the","mask","inference","correct",".","customized_replacers","A","list","of","``","Replacer","``",".","The","replacer","is","used","to","replace","the","origin","module","with","a","compressed","module",".","Users","can","costomized","the","replacement","logic","by","customized","a","replacer",".","Before","the","built-in","replacement","logic","in","nni","is","executed",",","the","replacement","logic","in","the","customized","replacer","list","will","be","executed","sequentially","first",".","graph_module","A","torch.fx.GraphModule",".","If","ModelSpeedup","default","concrete","trace","can","not","meet","the","needs",",","users","can","directly","pass","in","a","torch.fx.GraphModule","instead",".","garbage_collect_values","If","the","garbage_collect_values","is","True",",","nni","will","delete","cache","information","after","the","cache","has","none","usage",".","logger","Set","a","logger",".","If","the","value","is","None",",","nni","will","use","the","default","logger","."]
code: def update_indirect_sparsity(self):
      # update indirect out mask
      self.logger.info("Update indirect sparsity...")
  
      for node in reversed(self.graph_module.graph.nodes):
          node: Node
          self.node_infos[node].mask_updater.indirect_update_preprocess(
              self, node
          )
  
      for node in reversed(self.graph_module.graph.nodes):
          node: Node
          self.node_infos[node].mask_updater.indirect_update_process(
              self, node
          )
          sp = (
              f", {sparsity_stats(self.masks.get(node.target, {}))}"
              if node.op == "call_module"
              else ""
          )
          sp += f', {sparsity_stats({"output mask": self.node_infos[node].output_masks})}'
          self.logger.info(
              "Update indirect mask for %s: %s%s",
              node.op,
              node.name,
              sp,
          )
  
      for node in reversed(self.graph_module.graph.nodes):
          node: Node
          self.node_infos[
              node
          ].mask_updater.indirect_update_postprocess(self, node)
  
imports: from __future__ import annotations
  import inspect
  import logging
  from pathlib import Path
  import tempfile
  from typing import Any, Dict, List
  import torch
  import torch.fx
  from torch.fx import GraphModule
  from torch.fx._compatibility import compatibility
  from torch.fx.node import Node, Target
  from torch.fx.passes.shape_prop import ShapeProp
  from nni.common.concrete_trace_utils import concrete_trace
  from nni.compression.utils import set_nested_attr
  from nni.compression.speedup.replacement import replace_module
  from .container import NodeInfo
  from .mask_conflict import fix_channel_mask_conflict, fix_group_mask_conflict, fix_weight_sharing_mask_conflict
  from .mask_updater import MaskUpdater, DefaultMaskUpdater, LeafModuleMaskUpdater, NoMaskUpdater, NoChangeMaskUpdater
  from .replacement import replace_module
  from .replacer import Replacer, DefaultReplacer
  from .utils import tree_map_zip, poss_deepcopy, randomize_like_with_shape, torch_integer_dtype
  from ..utils import set_nested_attr
label_desc: Use image node_id 12 for calling the ModelSpeedup obj's underlying member method code with example usage: obj.update_indirect_sparsity() without return types