class_docstr: This class is used to build reduced-space formulations
  of neural networks.
  
  Parameters
  ----------
  network_structure : NetworkDefinition
      the neural network definition
  activation_functions : dict-like or None
      overrides the actual functions used for particular activations
class_docstr_tok: ["This","class","is","used","to","build","reduced-space","formulations","of","neural","networks",".","Parameters","--","--","--","--","--","network_structure",":","NetworkDefinition","the","neural","network","definition","activation_functions",":","dict-like","or","None","overrides","the","actual","functions","used","for","particular","activations"]
code: def _build_formulation(self):
      _setup_scaled_inputs_outputs(
          self.block, self.__scaling_object, self.__scaled_input_bounds
      )
  
      net = self.__network_definition
      layers = list(net.layers)
      block = self.block
  
      # create the blocks for each layer
      block.layers = pyo.Set(
          initialize=[id(layer) for layer in layers], ordered=True
      )
      block.layer = pyo.Block(block.layers)
  
      # currently only support a single input layer
      input_layers = list(net.input_layers)
      if len(input_layers) != 1:
          raise ValueError(
              "build_formulation called with a network that has more than"
              " one input layer. Only single input layers are supported."
          )
      input_layer = input_layers[0]
      input_layer_id = id(input_layer)
      input_layer_block = block.layer[input_layer_id]
  
      # connect the outputs of the input layer to
      # the main inputs on the block
      @input_layer_block.Expression(input_layer.output_indexes)
      def z(b, *output_index):
          pb = b.parent_block()
          return pb.scaled_inputs[output_index]
  
      # loop over the layers and build the expressions
      for layer in layers:
          if isinstance(layer, InputLayer):
              # skip the InputLayer
              continue
  
          # TODO: Add error checking on layer type
          # build the linear expressions and the activation function
          layer_id = id(layer)
          layer_block = block.layer[layer_id]
          layer_func = reduced_space_dense_layer  # layer_constraints[type(layer)]
          activation_func = self._activation_functions.get(
              layer.activation, None
          )
          if activation_func is None:
              raise ValueError(
                  "Activation {} is not supported by this formulation.".format(
                      layer.activation
                  )
              )
  
          layer_func(block, net, layer_block, layer, activation_func)
  
      # setup output variable constraints
      # currently only support a single output layer
      output_layers = list(net.output_layers)
      if len(output_layers) != 1:
          raise ValueError(
              "build_formulation called with a network that has more than"
              " one output layer. Only single output layers are supported."
          )
      output_layer = output_layers[0]
  
      @block.Constraint(output_layer.output_indexes)
      def output_assignment(b, *output_index):
          pb = b.parent_block()
          return (
              b.scaled_outputs[output_index]
              == b.layer[id(output_layer)].z[output_index]
          )
  
imports: import numpy
  import pyomo.environ
  from omlt.formulation import _PyomoFormulation, _setup_scaled_inputs_outputs
  from omlt.neuralnet.activations import ACTIVATION_FUNCTION_MAP
  from omlt.neuralnet.activations import ComplementarityReLUActivation, bigm_relu_activation_constraint, linear_activation_constraint, linear_activation_function, sigmoid_activation_constraint, sigmoid_activation_function, softplus_activation_constraint, softplus_activation_function, tanh_activation_constraint, tanh_activation_function
  from omlt.neuralnet.layer import ConvLayer2D, DenseLayer, InputLayer, PoolingLayer2D
  from omlt.neuralnet.layers.full_space import full_space_conv2d_layer, full_space_dense_layer, full_space_maxpool2d_layer
  from omlt.neuralnet.layers.partition_based import default_partition_split_func, partition_based_dense_relu_layer
  from omlt.neuralnet.layers.reduced_space import reduced_space_dense_layer
label_desc: Use image node_id 3 for calling the ReducedSpaceNNFormulation obj's underlying member method code with example usage: obj._build_formulation() and returns: pb, unknown