Exemplo n.º 1
0
		def _die(fctName, outputLayer, kwargs, exc) :
			localStr = "!!=> Error in function '%s' for layer '%s':\n%s\n" % (fctName, outputLayer.name, exc.message)
			sys.stderr.write(localStr)
			sys.stderr.write("Have a look at the log file: %s for details about the arguments" % MSET.SAVE_MESSAGE_LOG_FILE)
			strArgs = []
			for k, v in kwargs.iteritems() :
				strArgs.append("%s, shape: %s \n----\n%s" % (k, numpy.asarray(v).shape, v))
			MCAN.fatal(localStr, "!!=> the arguments were:\n %s\n" % ('\n'.join(strArgs)), toRaise = exc)
Exemplo n.º 2
0
	def clone(self, reset = False) :
		"""Returns a free layer with the same parameters. You can use kwargs to setup any attribute of the new layer"""
		if self.creationArguments is None :
			MCAN.fatal("Unclonable layer '%s'" % self.name, "self.creationArguments is not defined.\nPlease add a call to Layer_ABC._setCreationArguments(self) at the end of the constructor.")
		
		obj = self.__class__( **self.creationArguments)
		obj._mustInit = True
		if reset :
			obj._mustReset = True
		else :
			obj._mustReset = False
			for k, v in self.getParameterDict().iteritems() :
				setattr(obj, k, v)

		return obj
Exemplo n.º 3
0
    def clone(self, reset=False):
        """Returns a free layer with the same parameters. You can use kwargs to setup any attribute of the new layer"""
        if self.creationArguments is None:
            MCAN.fatal(
                "Unclonable layer '%s'" % self.name,
                "self.creationArguments is not defined.\nPlease add a call to Layer_ABC._setCreationArguments(self) at the end of the constructor."
            )

        obj = self.__class__(**self.creationArguments)
        obj._mustInit = True
        if reset:
            obj._mustReset = True
        else:
            obj._mustReset = False
            for k, v in self.getParameterDict().iteritems():
                setattr(obj, k, v)

        return obj