class_docstr: A MinCut pooling layer from the paper
  
  > [Spectral Clustering with Graph Neural Networks for Graph Pooling](https://arxiv.org/abs/1907.00481)<br>
  > Filippo Maria Bianchi et al.
  
  **Mode**: single, batch.
  
  This layer learns a soft clustering of the input graph as follows:
  $$
  \begin{align}
      \S &= \textrm{MLP}(\X); \\
      \X' &= \S^\top \X \\
      \A' &= \S^\top \A \S; \\
  \end{align}
  $$
  where \(\textrm{MLP}\) is a multi-layer perceptron with softmax output.
  
  Two auxiliary loss terms are also added to the model: the minimum cut loss
  $$
      L_c = - \frac{ \mathrm{Tr}(\S^\top \A \S) }{ \mathrm{Tr}(\S^\top \D \S) }
  $$
  and the orthogonality loss
  $$
      L_o = \left\|
          \frac{\S^\top \S}{\| \S^\top \S \|_F}
          - \frac{\I_K}{\sqrt{K}}
      \right\|_F.
  $$
  
  The layer can be used without a supervised loss to compute node clustering by
  minimizing the two auxiliary losses.
  
  **Input**
  
  - Node features of shape `(batch, n_nodes_in, n_node_features)`;
  - Symmetrically normalized adjacency matrix of shape
  `(batch, n_nodes_in, n_nodes_in)`;
  
  **Output**
  
  - Reduced node features of shape `(batch, n_nodes_out, n_node_features)`;
  - Reduced adjacency matrix of shape `(batch, n_nodes_out, n_nodes_out)`;
  - If `return_selection=True`, the selection matrix of shape
  `(batch, n_nodes_in, n_nodes_out)`.
  
  **Arguments**
  
  - `k`: number of output nodes;
  - `mlp_hidden`: list of integers, number of hidden units for each hidden layer in
  the MLP used to compute cluster assignments (if `None`, the MLP has only one output
  layer);
  - `mlp_activation`: activation for the MLP layers;
  - `return_selection`: boolean, whether to return the selection matrix;
  - `use_bias`: use bias in the MLP;
  - `kernel_initializer`: initializer for the weights of the MLP;
  - `bias_initializer`: initializer for the bias of the MLP;
  - `kernel_regularizer`: regularization applied to the weights of the MLP;
  - `bias_regularizer`: regularization applied to the bias of the MLP;
  - `kernel_constraint`: constraint applied to the weights of the MLP;
  - `bias_constraint`: constraint applied to the bias of the MLP;
class_docstr_tok: ["A","MinCut","pooling","layer","from","the","paper",">","[","Spectral","Clustering","with","Graph","Neural","Networks","for","Graph","Pooling","]","(","https",":","\/\/arxiv.org\/abs\/1907.00481",")","<","br",">",">","Filippo","Maria","Bianchi","et","al",".","*","*","Mode","*","*",":","single",",","batch",".","This","layer","learns","a","soft","clustering","of","the","input","graph","as","follows",":","$","$","\\begin","{","align","}","\\S","&","=","\\textrm","{","MLP","}","(","\\X",")",";","\\\\","\\X","'","&","=","\\S^\\top","\\X","\\\\","\\A","'","&","=","\\S^\\top","\\A","\\S",";","\\\\","\\end","{","align","}","$","$","where","\\","(","\\textrm","{","MLP","}","\\",")","is","a","multi-layer","perceptron","with","softmax","output",".","Two","auxiliary","loss","terms","are","also","added","to","the","model",":","the","minimum","cut","loss","$","$","L_c","=","-","\\frac","{","\\mathrm","{","Tr","}","(","\\S^\\top","\\A","\\S",")","}","{","\\mathrm","{","Tr","}","(","\\S^\\top","\\D","\\S",")","}","$","$","and","the","orthogonality","loss","$","$","L_o","=","\\left\\|","\\frac","{","\\S^\\top","\\S","}","{","\\|","\\S^\\top","\\S","\\|_F","}","-","\\frac","{","\\I_K","}","{","\\sqrt","{","K","}","}","\\right\\|_F",".","$","$","The","layer","can","be","used","without","a","supervised","loss","to","compute","node","clustering","by","minimizing","the","two","auxiliary","losses",".","*","*","Input","*","*","-","Node","features","of","shape","`","(","batch",",","n_nodes_in",",","n_node_features",")","`",";","-","Symmetrically","normalized","adjacency","matrix","of","shape","`","(","batch",",","n_nodes_in",",","n_nodes_in",")","`",";","*","*","Output","*","*","-","Reduced","node","features","of","shape","`","(","batch",",","n_nodes_out",",","n_node_features",")","`",";","-","Reduced","adjacency","matrix","of","shape","`","(","batch",",","n_nodes_out",",","n_nodes_out",")","`",";","-","If","`","return_selection=True","`",",","the","selection","matrix","of","shape","`","(","batch",",","n_nodes_in",",","n_nodes_out",")","`",".","*","*","Arguments","*","*","-","`","k","`",":","number","of","output","nodes",";","-","`","mlp_hidden","`",":","list","of","integers",",","number","of","hidden","units","for","each","hidden","layer","in","the","MLP","used","to","compute","cluster","assignments","(","if","`","None","`",",","the","MLP","has","only","one","output","layer",")",";","-","`","mlp_activation","`",":","activation","for","the","MLP","layers",";","-","`","return_selection","`",":","boolean",",","whether","to","return","the","selection","matrix",";","-","`","use_bias","`",":","use","bias","in","the","MLP",";","-","`","kernel_initializer","`",":","initializer","for","the","weights","of","the","MLP",";","-","`","bias_initializer","`",":","initializer","for","the","bias","of","the","MLP",";","-","`","kernel_regularizer","`",":","regularization","applied","to","the","weights","of","the","MLP",";","-","`","bias_regularizer","`",":","regularization","applied","to","the","bias","of","the","MLP",";","-","`","kernel_constraint","`",":","constraint","applied","to","the","weights","of","the","MLP",";","-","`","bias_constraint","`",":","constraint","applied","to","the","bias","of","the","MLP",";"]
code: def build(self, input_shape):
      layer_kwargs = dict(
          kernel_initializer=self.kernel_initializer,
          bias_initializer=self.bias_initializer,
          kernel_regularizer=self.kernel_regularizer,
          bias_regularizer=self.bias_regularizer,
          kernel_constraint=self.kernel_constraint,
          bias_constraint=self.bias_constraint,
      )
      self.mlp = Sequential(
          [
              Dense(channels, self.mlp_activation, **layer_kwargs)
              for channels in self.mlp_hidden
          ]
          + [Dense(self.k, "softmax", **layer_kwargs)]
      )
  
      super().build(input_shape)
  
file_path: spektral/spektral/layers/pooling/mincut_pool.py
imports: import tensorflow
  from tensorflow.keras import Sequential
  from tensorflow.keras import backend
  from tensorflow.keras.layers import Dense
  from spektral.layers import ops
  from spektral.layers.pooling.src import SRCPool
label_desc: Use image node_id 2 for calling the MinCutPool obj's underlying member method code with example usage: obj.build(input_shape) without return types