Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Binary file added examples/data/raw/field.mat
Binary file not shown.
34 changes: 23 additions & 11 deletions examples/inference_bars_example.ipynb

Large diffs are not rendered by default.

223 changes: 0 additions & 223 deletions examples/inference_example.ipynb

This file was deleted.

103 changes: 57 additions & 46 deletions examples/inference_natural_images.ipynb

Large diffs are not rendered by default.

92 changes: 55 additions & 37 deletions examples/ista_example.ipynb

Large diffs are not rendered by default.

985 changes: 11 additions & 974 deletions examples/simultaneous.ipynb

Large diffs are not rendered by default.

49 changes: 17 additions & 32 deletions examples/sparse_coding.ipynb

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions tutorials/vanilla/src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import matplotlib.pyplot as plt
from scipy.interpolate import make_interp_spline
import scipy.io as sio
from sparsecoding import preprocess
from sparsecoding.data.transforms.patch import patchify
import torch
from torchvision.utils import make_grid

Expand Down Expand Up @@ -151,12 +151,11 @@ def create_patches(imgs, epochs, batch_size, N, rng):
-------
patches : Tensor of size (batch_size, pixels_per_patch).
"""
n_divisions = imgs.shape[1]//int(np.sqrt(N))
patches = preprocess.patch_images(imgs.permute(1, 2, 0), n_divisions)[0]
patches = patches.reshape(
patches.shape[0] * patches.shape[1], patches.shape[2], patches.shape[3])
perm = torch.randint(low=0, high=patches.shape[0], size=(
1, epochs*batch_size), generator=rng)
patch_size = int(np.sqrt(N))
patches = patchify(patch_size, imgs.unsqueeze(1))
patches = patches.reshape(-1, patch_size, patch_size)
perm = torch.randint(low=0, high=patches.shape[0],
size=(epochs*batch_size,), generator=rng)
patches = patches[perm].reshape(
(epochs, batch_size, N))
return patches
Expand Down
72 changes: 44 additions & 28 deletions tutorials/vanilla/tutorial.ipynb

Large diffs are not rendered by default.