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: export the channel dependencies as a csv file.
  The layers at the same line have output channel
  dependencies with each other. For example,
  layer1.1.conv2, conv1, and layer1.0.conv2 have
  output channel dependencies with each other, which
  means the output channel(filters) numbers of these
  three layers should be same with each other, otherwise
  the model may has shape conflict.
  Output example:
  Dependency Set,Convolutional Layers
  Set 1,layer1.1.conv2,layer1.0.conv2,conv1
  Set 2,layer1.0.conv1
  Set 3,layer1.1.conv1
docstr_tok: ["export","the","channel","dependencies","as","a","csv","file",".","The","layers","at","the","same","line","have","output","channel","dependencies","with","each","other",".","For","example",",","layer1.1.conv2",",","conv1",",","and","layer1.0.conv2","have","output","channel","dependencies","with","each","other",",","which","means","the","output","channel","(","filters",")","numbers","of","these","three","layers","should","be","same","with","each","other",",","otherwise","the","model","may","has","shape","conflict",".","Output","example",":","Dependency","Set",",","Convolutional","Layers","Set","1",",","layer1.1.conv2",",","layer1.0.conv2",",","conv1","Set","2",",","layer1.0.conv1","Set","3",",","layer1.1.conv1"]
code: def export(self, filepath):
      """
      export the channel dependencies as a csv file.
      The layers at the same line have output channel
      dependencies with each other. For example,
      layer1.1.conv2, conv1, and layer1.0.conv2 have
      output channel dependencies with each other, which
      means the output channel(filters) numbers of these
      three layers should be same with each other, otherwise
      the model may has shape conflict.
      Output example:
      Dependency Set,Convolutional Layers
      Set 1,layer1.1.conv2,layer1.0.conv2,conv1
      Set 2,layer1.0.conv1
      Set 3,layer1.1.conv1
      """
      header = ["Dependency Set", "Layers"]
      setid = 0
      visited = set()
      with open(filepath, "w") as csvf:
          csv_w = csv.writer(csvf, delimiter=",")
          csv_w.writerow(header)
          for node in self.graph.nodes_py.nodes_op:
              if (
                  node.op_type not in self.target_types
                  or node in visited
              ):
                  continue
              setid += 1
              row = ["Set %d" % setid]
              if node.name not in self.dependency:
                  visited.add(node)
                  row.append(node.name)
              else:
                  for other in self.dependency[node.name]:
                      visited.add(self.graph.name_to_node[other])
                      row.append(other)
              csv_w.writerow(row)
  
imports: import csv
  import logging
  import torch
  import numpy
  from .attr import get_nested_attr
label_desc: Use image node_id 7 for calling the ChannelDependency obj's underlying member method code with example usage: obj.export(filepath) without return types