code: def changeLayerSize(self, layername, newsize):
          
          # for all connection from to this layer, change matrix:
          if self.sharedWeights:
              raise AttributeError("shared weights broken")
          for connection in self.connections:
              if connection.fromLayer.name == layername:
                  connection.changeSize(  newsize, connection.toLayer.size )
              if connection.toLayer.name == layername:
                  connection.changeSize( connection.fromLayer.size, newsize )
          # then, change the actual layer size:
          self.getLayer(layername).changeSize(newsize)
docs: Changes layer size. Newsize must be greater than zero.