示例#1
0
    def create(self, architecture: Architecture, metadata: Metadata,
               arguments: Configuration) -> Any:
        # collect the parameters from the indicated models
        parameters = []
        for module_name in arguments.parameters:
            parameters.extend(architecture[module_name].parameters())

        # copy the rest of the arguments
        arguments = {}
        for key, value in arguments.items():
            if key != "parameters":
                arguments[key] = value

        # create the optimizer
        return self.optimizer_class(parameters, **arguments)
示例#2
0
    def create(self, architecture: Architecture, metadata: Metadata,
               arguments: Configuration) -> Any:
        # separate arguments
        noise_layer_arguments = None
        autoencoder_arguments = Configuration()
        for argument_name, argument_value in arguments.items():
            if argument_name == "noise_layer":
                noise_layer_arguments = argument_value
            else:
                autoencoder_arguments[argument_name] = argument_value

        noise_layer = self.create_other(
            noise_layer_arguments.factory, architecture, metadata,
            noise_layer_arguments.get("arguments", {}))

        autoencoder = self.create_other(self.factory_name, architecture,
                                        metadata, autoencoder_arguments)

        return DeNoisingAutoencoder(noise_layer, autoencoder)