def resizedTo(self, newsize):
        if newsize == self.size:
            return self.copy()
        else:
            import copy
            # TODO: ugly hack!
            # remove recurrent references
            for mc in self.motherconnections:
                mc.owner = None
            # copy the connections from the self.predefined dictionnary:
            cdict = copy.deepcopy(self.predefined)
            args = self.argdict.copy()
            args['size'] = newsize
            del args['rebuilt']
            # put the references back in
            for mc in self.motherconnections:
                mc.owner = self
            return CaptureGameNetwork(predefined = cdict, **args)
Produce a copy of the network, with a different size but with the same (shared) weights,
dataset/ETHPy150Open pybrain/pybrain/pybrain/structure/networks/custom/capturegame.py/CaptureGameNetwork.resizedTo