Skip to content

Commit

Permalink
test with LSM prior
Browse files Browse the repository at this point in the history
  • Loading branch information
alvinzz committed May 25, 2022
1 parent 6ca4f1e commit c48b2c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tests/inference/common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import torch

from sparsecoding.priors.l0 import L0Prior
from sparsecoding.priors.lsm import LSMPrior
from sparsecoding.priors.spike_slab import SpikeSlabPrior
from sparsecoding.data.datasets.bars import BarsDataset

Expand All @@ -24,6 +25,12 @@
).type(torch.float32)
),
),
LSMPrior(
dim=2 * PATCH_SIZE,
alpha=80.0,
beta=0.02,
positive_only=False,
),
]

DATASET = [
Expand Down
2 changes: 1 addition & 1 deletion tests/inference/test_LSM.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_inference(self):

a = inference_method.infer(data, DICTIONARY)

self.assertAllClose(a, dataset.weights, atol=5e-2)
self.assertAllClose(a, dataset.weights, atol=7.5e-2)


if __name__ == "__main__":
Expand Down

0 comments on commit c48b2c3

Please sign in to comment.