def create(self, architecture: Architecture, metadata: Metadata, arguments: Configuration) -> Any: reconstruction_loss = self.create_other( arguments.reconstruction_loss.factory, architecture, metadata, arguments.reconstruction_loss.get("arguments", {})) return AutoEncoderLoss(reconstruction_loss, **arguments.get_all_defined(["masked"]))
def create(self, architecture: Architecture, metadata: Metadata, arguments: Configuration) -> Any: reconstruction_loss = self.create_other( arguments.reconstruction_loss.factory, architecture, metadata, arguments.reconstruction_loss.get("arguments", {})) optional_arguments = arguments.get_all_defined( ["reconstruction_loss_weight"]) return GAINGeneratorLoss(reconstruction_loss, **optional_arguments)
def create(self, architecture: Architecture, metadata: Metadata, arguments: Configuration) -> Any: optional = arguments.get_all_defined(["sizes", "bn_decay", "shortcut"]) if "activation" in arguments: activation_configuration = arguments.activation optional["activation"] = self.create_other( activation_configuration.factory, architecture, metadata, activation_configuration.get("arguments", {})) return HiddenLayersFactory(**optional)
def create(self, architecture: Architecture, metadata: Metadata, arguments: Configuration) -> Any: # override the reduction argument reconstruction_loss_configuration = arguments.reconstruction_loss.get( "arguments", {}) if "reduction" in reconstruction_loss_configuration: assert reconstruction_loss_configuration["reduction"] == "sum" else: reconstruction_loss_configuration["reduction"] = "sum" # create the reconstruction loss reconstruction_loss = self.create_other( arguments.reconstruction_loss.factory, architecture, metadata, reconstruction_loss_configuration) # create the vae loss return VAELoss(reconstruction_loss, **arguments.get_all_defined(["masked"]))
def create(self, architecture: Architecture, metadata: Metadata, arguments: Configuration) -> Any: return MultiInputDropout( metadata, **arguments.get_all_defined(self.optional_arguments()))
def create(self, architecture: Architecture, metadata: Metadata, arguments: Configuration) -> Any: return self.wrapped_class( **arguments.get_all_defined(self.optional_class_arguments))
def impute(self, configuration: Configuration, metadata: Metadata, scaled_inputs: Tensor, missing_mask: Tensor) -> Tensor: optional = configuration.get_all_defined(["noise_mean", "noise_std"]) optional["differentiable"] = False return NormalNoiseImputationLayer(**optional)(scaled_inputs, missing_mask)
def create(self, architecture: Architecture, metadata: Metadata, arguments: Configuration) -> Any: return MeanAndModesImputationLayer( to_gpu_if_available( torch.from_numpy(np.load(arguments.path)).float()), **arguments.get_all_defined(["differentiable"]))
def create(self, architecture: Architecture, metadata: Metadata, arguments: Configuration) -> Any: return MultiReconstructionLoss(metadata, **arguments.get_all_defined(self.optional_arguments()))