Exemple #1
0
    def __init__(self,
                 data_dim,
                 latent_dim,
                 encoder,
                 outer_transform,
                 inner_transform=None,
                 pie_epsilon=1.0e-2,
                 apply_context_to_outer=True):
        super(EncoderManifoldFlow, self).__init__()

        assert latent_dim < data_dim

        self.data_dim = data_dim
        self.latent_dim = latent_dim
        self.total_data_dim = product(data_dim)
        self.total_latent_dim = product(latent_dim)
        self.apply_context_to_outer = apply_context_to_outer

        self.manifold_latent_distribution = distributions.StandardNormal(
            (self.total_latent_dim, ))
        self.orthogonal_latent_distribution = distributions.RescaledNormal(
            (self.total_data_dim - self.total_latent_dim, ),
            std=pie_epsilon,
            clip=5.0 * pie_epsilon)
        self.projection = ProjectionSplit(self.total_data_dim,
                                          self.total_latent_dim)

        self.encoder = encoder
        self.outer_transform = outer_transform
        if inner_transform is None:
            self.inner_transform = transforms.IdentityTransform()
        else:
            self.inner_transform = inner_transform

        self._report_model_parameters()
    def __init__(self, data_dim, transform):
        super(VariableDimensionManifoldFlow, self).__init__()

        self.data_dim = data_dim
        self.latent_dim = data_dim
        self.total_data_dim = product(data_dim)
        self.total_latent_dim = product(self.latent_dim)

        self.latent_distribution = distributions.DiagonalNormal(
            (self.total_latent_dim, ), initial_std=0.5)
        self.transform = transform

        self._report_model_parameters()
Exemple #3
0
    def __init__(self, data_dim, transform):
        super(Flow, self).__init__()

        self.data_dim = data_dim
        self.latent_dim = data_dim
        self.total_data_dim = product(data_dim)
        self.total_latent_dim = product(self.latent_dim)

        self.latent_distribution = distributions.StandardNormal(
            (self.total_latent_dim, ))
        self.transform = transform

        self._report_model_parameters()
Exemple #4
0
    def __init__(self, input_dim, output_dim):
        super().__init__()

        self.input_dim = input_dim
        self.output_dim = output_dim
        self.input_dim_total = product(input_dim)
        self.output_dim_total = product(output_dim)
        self.mode_in = "vector" if isinstance(input_dim, int) else "image"
        self.mode_out = "vector" if isinstance(input_dim, int) else "image"

        logger.debug(
            "Set up projection from %s with dimension %s to %s with dimension %s",
            self.mode_in, self.input_dim, self.mode_out, self.output_dim)

        assert self.input_dim_total >= self.output_dim_total, "Input dimension has to be larger than output dimension"
Exemple #5
0
    def __init__(self, data_dim, latent_dim, encoder, decoder, inner_transform=None, apply_context_to_outer=True):
        super(ProbabilisticAutoEncoder, self).__init__()

        self.data_dim = data_dim
        self.latent_dim = latent_dim
        self.total_data_dim = product(data_dim)
        self.total_latent_dim = product(latent_dim)
        self.apply_context_to_outer = apply_context_to_outer

        assert self.total_latent_dim < self.total_data_dim

        self.manifold_latent_distribution = distributions.StandardNormal((self.total_latent_dim,))

        self.encoder = encoder
        self.decoder = decoder
        if inner_transform is None:
            self.inner_transform = transforms.IdentityTransform()
        else:
            self.inner_transform = inner_transform

        self._report_model_parameters()