code: def add_reshape(self, name, input_name, output_name, target_shape, mode):
          
  
          spec = self.spec
          nn_spec = self.nn_spec
  
          # Add a new layer
          spec_layer = nn_spec.layers.add()
          spec_layer.name = name
          spec_layer.input.append(input_name)
          spec_layer.output.append(output_name)
  
          spec_layer_params = spec_layer.reshape
          spec_layer_params.targetShape.extend(target_shape)
          if mode == 0:
              spec_layer_params.mode = \
                      _NeuralNetwork_pb2.ReshapeLayerParams.ReshapeOrder.Value('CHANNEL_FIRST')
          else:
              spec_layer_params.mode = \
                      _NeuralNetwork_pb2.ReshapeLayerParams.ReshapeOrder.Value('CHANNEL_LAST')
  
          if len(target_shape) != 4 and len(target_shape) != 3:
              raise ValueError("Length of the 'target-shape' parameter must be equal to 3 or 4")
docs: Add a reshape layer. Kindly refer to NeuralNetwork.proto for details.
  
          Parameters
          ----------
          name: str
              The name of this layer.
          target_shape: tuple
              Shape of the output blob. The product of target_shape must be equal
              to the shape of the input blob.
              Can be either length 3 (C,H,W) or length 4 (Seq,C,H,W).
          mode: int
  
              - If mode == 0, the reshape layer is in CHANNEL_FIRST mode.
              - If mode == 1, the reshape layer is in CHANNEL_LAST mode.
  
          input_name: str
              The input blob name of this layer.
          output_name: str
              The output blob name of this layer.
  
          See Also
          --------
          add_flatten, add_permute