original_docstring: 
      Counts the number weights and FLOPs per node in the model for convolution and fully connected layers.
  
      :param graph: NNCFGraph.
      :param input_shapes: Dictionary of input dimension shapes for convolutions and
          fully connected layers. E.g {node_name: (height, width)}
      :param output_shapes: Dictionary of output dimension shapes for convolutions and
          fully connected layers. E.g {node_name: (height, width)}
      :param conv_op_metatypes: List of metatypes defining convolution operations.
      :param linear_op_metatypes: List of metatypes defining linear/fully connected operations.
      :param input_channels: Dictionary of input channels number in convolutions.
          If not specified, taken from the graph. {node_name: channels_num}
      :param output_channels: Dictionary of output channels number in convolutions.
          If not specified, taken from the graph. {node_name: channels_num}
      :return Dictionary of FLOPs number {node_name: flops_num}
              Dictionary of weights number {node_name: weights_num}
      
docstring: Counts the number weights and FLOPs per node in the model for convolution and fully connected layers.
docstring_tokens: Counts the number weights and FLOPs per node in the model for convolution and fully connected layers .
code: def count_flops_and_weights_per_node(graph: NNCFGraph,
                                       input_shapes: Dict[NNCFNodeName, List[int]],
                                       output_shapes: Dict[NNCFNodeName, List[int]],
                                       conv_op_metatypes: List[Type[OperatorMetatype]],
                                       linear_op_metatypes: List[Type[OperatorMetatype]],
                                       input_channels: Dict[NNCFNodeName, int] = None,
                                       output_channels: Dict[NNCFNodeName, int] = None) -> \
          Tuple[Dict[NNCFNodeName, int], Dict[NNCFNodeName, int]]:
      """
      Counts the number weights and FLOPs per node in the model for convolution and fully connected layers.
  
      :param graph: NNCFGraph.
      :param input_shapes: Dictionary of input dimension shapes for convolutions and
          fully connected layers. E.g {node_name: (height, width)}
      :param output_shapes: Dictionary of output dimension shapes for convolutions and
          fully connected layers. E.g {node_name: (height, width)}
      :param conv_op_metatypes: List of metatypes defining convolution operations.
      :param linear_op_metatypes: List of metatypes defining linear/fully connected operations.
      :param input_channels: Dictionary of input channels number in convolutions.
          If not specified, taken from the graph. {node_name: channels_num}
      :param output_channels: Dictionary of output channels number in convolutions.
          If not specified, taken from the graph. {node_name: channels_num}
      :return Dictionary of FLOPs number {node_name: flops_num}
              Dictionary of weights number {node_name: weights_num}
      """
      flops = {}
      weights = {}
      input_channels = input_channels or {}
      output_channels = output_channels or {}
      for node in graph.get_nodes_by_metatypes(conv_op_metatypes):
          name = node.node_name
          num_in_channels = input_channels.get(name, node.layer_attributes.in_channels)
          num_out_channels = output_channels.get(name, node.layer_attributes.out_channels)
          filters_per_channel = num_out_channels // node.layer_attributes.groups
          flops_numpy = 2 * np.prod(node.layer_attributes.kernel_size) * \
                        num_in_channels * filters_per_channel * np.prod(output_shapes[name])
          weights_numpy = np.prod(node.layer_attributes.kernel_size) * num_in_channels * filters_per_channel
          flops[name] = flops_numpy.astype(int).item()
          weights[name] = weights_numpy.astype(int).item()
  
      for node in graph.get_nodes_by_metatypes(linear_op_metatypes):
          name = node.node_name
          flops_numpy = 2 * np.prod(input_shapes[name]) * np.prod(output_shapes[name])
          weights_numpy = np.prod(input_shapes[name]) * np.prod(output_shapes[name])
          flops[name] = flops_numpy.astype(int).item()
          weights[name] = weights_numpy.astype(int).item()
  
      return flops, weights
code_tokens: def count_flops_and_weights_per_node ( graph : NNCFGraph , input_shapes : Dict [ NNCFNodeName , List [ int ] ] , output_shapes : Dict [ NNCFNodeName , List [ int ] ] , conv_op_metatypes : List [ Type [ OperatorMetatype ] ] , linear_op_metatypes : List [ Type [ OperatorMetatype ] ] , input_channels : Dict [ NNCFNodeName , int ] = None , output_channels : Dict [ NNCFNodeName , int ] = None ) -> Tuple [ Dict [ NNCFNodeName , int ] , Dict [ NNCFNodeName , int ] ] : flops = { } weights = { } input_channels = input_channels or { } output_channels = output_channels or { } for node in graph . get_nodes_by_metatypes ( conv_op_metatypes ) : name = node . node_name num_in_channels = input_channels . get ( name , node . layer_attributes . in_channels ) num_out_channels = output_channels . get ( name , node . layer_attributes . out_channels ) filters_per_channel = num_out_channels // node . layer_attributes . groups flops_numpy = 2 * np . prod ( node . layer_attributes . kernel_size ) * num_in_channels * filters_per_channel * np . prod ( output_shapes [ name ] ) weights_numpy = np . prod ( node . layer_attributes . kernel_size ) * num_in_channels * filters_per_channel flops [ name ] = flops_numpy . astype ( int ) . item ( ) weights [ name ] = weights_numpy . astype ( int ) . item ( ) for node in graph . get_nodes_by_metatypes ( linear_op_metatypes ) : name = node . node_name flops_numpy = 2 * np . prod ( input_shapes [ name ] ) * np . prod ( output_shapes [ name ] ) weights_numpy = np . prod ( input_shapes [ name ] ) * np . prod ( output_shapes [ name ] ) flops [ name ] = flops_numpy . astype ( int ) . item ( ) weights [ name ] = weights_numpy . astype ( int ) . item ( ) return flops , weights
short_docstring: Counts the number weights and FLOPs per node in the model for convolution and fully connected layers.
short_docstring_tokens: Counts the number weights and FLOPs per node in the model for convolution and fully connected layers .
comment: """
      Counts the number weights and FLOPs per node in the model for convolution and fully connected layers.
  
      :param graph: NNCFGraph.
      :param input_shapes: Dictionary of input dimension shapes for convolutions and
          fully connected layers. E.g {node_name: (height, width)}
      :param output_shapes: Dictionary of output dimension shapes for convolutions and
          fully connected layers. E.g {node_name: (height, width)}
      :param conv_op_metatypes: List of metatypes defining convolution operations.
      :param linear_op_metatypes: List of metatypes defining linear/fully connected operations.
      :param input_channels: Dictionary of input channels number in convolutions.
          If not specified, taken from the graph. {node_name: channels_num}
      :param output_channels: Dictionary of output channels number in convolutions.
          If not specified, taken from the graph. {node_name: channels_num}
      :return Dictionary of FLOPs number {node_name: flops_num}
              Dictionary of weights number {node_name: weights_num}
      """