Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

L1 loss added to the models #85

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
minor modifications for PR 75
soumickmj committed Feb 7, 2023

Verified

This commit was signed with the committer’s verified signature.
jeffkala Jeff Kala
commit 1a8652cc3588b62e16a64d7da518494332664724
11 changes: 5 additions & 6 deletions src/pythae/models/base/base_model.py
Original file line number Diff line number Diff line change
@@ -117,17 +117,16 @@ def reconstruct(self, inputs: torch.Tensor):
"""
return self(DatasetOutput(data=inputs)).recon_x

def predict(self, inputs: BaseDataset, **kwargs) -> ModelOutput:
def predict(self, inputs: torch.Tensor) -> ModelOutput:
"""The input data is encoded and decoded without computing loss

Args:
inputs (BaseDataset): An instance of pythae's datasets
inputs (torch.Tensor): The input data to be reconstructed, as well as to generate the embedding.

Returns:
ModelOutput: An instance of ModelOutput containing reconstruction and embedding
"""

x = inputs["data"]

z = self.encoder(x).embedding
z = self.encoder(inputs).embedding
recon_x = self.decoder(z)["reconstruction"]

output = ModelOutput(
3 changes: 1 addition & 2 deletions tests/test_AE.py
Original file line number Diff line number Diff line change
@@ -376,8 +376,7 @@ def ae(self, model_configs, demo_data):
def test_predict(self, ae, demo_data):

model_output = ae.predict(demo_data)
assert tuple(model_output.recon_x.shape) == demo_data.shape
assert tuple(model_output.embedding.shape) == ae.model_config.latent_dim.shape
assert tuple(model_output.embedding.shape) == (demo_data.shape[0], ae.model_config.latent_dim)

@pytest.mark.slow
class Test_AE_Training: