class_docstr: This model analyze the channel dependencies between the conv
  layers in a model.
  
  Parameters
  ----------
  model : torch.nn.Module
      The model to be analyzed.
  data : torch.Tensor
      The example input data to trace the network architecture.
  traced_model : torch._C.Graph
      if we alreay has the traced graph of the target model, we donnot
      need to trace the model again.
  prune_type: str
      This parameter indicates the channel pruning type: 1) `Filter`
      prune the filter of the convolution layer to prune the corresponding
      channels 2) `Batchnorm`: prune the channel in the batchnorm layer
class_docstr_tok: ["This","model","analyze","the","channel","dependencies","between","the","conv","layers","in","a","model",".","Parameters","--","--","--","--","--","model",":","torch.nn.Module","The","model","to","be","analyzed",".","data",":","torch.Tensor","The","example","input","data","to","trace","the","network","architecture",".","traced_model",":","torch._C.Graph","if","we","alreay","has","the","traced","graph","of","the","target","model",",","we","donnot","need","to","trace","the","model","again",".","prune_type",":","str","This","parameter","indicates","the","channel","pruning","type",":","1",")","`","Filter","`","prune","the","filter","of","the","convolution","layer","to","prune","the","corresponding","channels","2",")","`","Batchnorm","`",":","prune","the","channel","in","the","batchnorm","layer"]
docstr: Build the channel dependency for the conv layers
  in the model.
docstr_tok: ["Build","the","channel","dependency","for","the","conv","layers","in","the","model","."]
code: def build_dependency(self):
      """
      Build the channel dependency for the conv layers
      in the model.
      """
      # unpack the tuple/list manually before analyze the
      # channel dependency
      self.graph.unpack_manually()
      for node in self.graph.nodes_py.nodes_op:
          parent_layers = []
          # find the node that contains aten::add
          # or aten::cat operations
          if node.op_type in ADD_MUL_LOGICAL_TYPES:
              # refer issue 4540 for more details. Multiplication actually
              # will not introduce the channel dependency, cause the misaligned
              # channels can propagate to each other. However, when one of the input
              # tensor is from skip connection(residual), the channel propagation
              # may be failed(the input is also used by another layer and cannot be
              # pruned), in this case, we need to fix the conflict maunally.
              parent_layers = self._get_parent_layers(node)
          elif node.op_type == CAT_TYPE:
              # To determine if this cat operation will introduce channel
              # dependency, we need the specific input parameters of the cat
              # opertion. To get the input parameters of the cat opertion, we
              # need to traverse all the cpp_nodes included by this NodePyGroup,
              # because, TorchModuleGraph merges the important nodes and the adjacent
              # unimportant nodes (nodes started with prim::attr, for example) into a
              # NodepyGroup.
              cat_dim = None
              for cnode in node.node_cpps:
                  if cnode.kind() == CAT_TYPE:
                      cat_dim = list(cnode.inputs())[1].toIValue()
                      break
              if cat_dim != 1:
                  parent_layers = self._get_parent_layers(node)
  
          # additional denpendency for (group number == output channel number) depth-wise conv
          if node.op_type in ["Conv2d", "ConvTranspose2d", "GroupNorm"]:
              if node.op_type in ["Conv2d", "ConvTranspose2d"]:
                  condition = self._conv_condition(node)
              elif node.op_type == "GroupNorm":
                  condition = self._group_norm_condition(node)
              if condition:
                  parent_layers.append(node.name)
                  parent_layers.extend(self._depthwise_get_parent(node))
  
          dependency_set = set(parent_layers)
          # merge the dependencies
          for parent in parent_layers:
              if parent in self.dependency:
                  dependency_set.update(self.dependency[parent])
          # save the dependencies
          for _node in dependency_set:
              self.dependency[_node] = dependency_set
  
imports: import csv
  import logging
  import torch
  import numpy
  from .attr import get_nested_attr
label_desc: Use image node_id 3 for calling the ChannelDependency obj's underlying member method code with example usage: obj.build_dependency() without return types