Skip to content

Commit

Permalink
only square images for now
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Jun 18, 2024
1 parent 82ea31e commit 081d4cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "titok-pytorch"
version = "0.0.1"
version = "0.0.2"
description = "TiTok - Pytorch"
authors = [
{ name = "Phil Wang", email = "lucidrains@gmail.com" }
Expand Down
4 changes: 4 additions & 0 deletions titok_pytorch/titok.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def __init__(
l - latents
"""

self.image_size = image_size

assert divisible_by(image_size, patch_size)

dim_patch = channels * patch_size ** 2
Expand Down Expand Up @@ -139,6 +141,8 @@ def forward(
return_codebook_ids = False,
return_recons = False
):
assert images.ndim == 4 and images.shape[-2:] == ((self.image_size,) * 2)

batch = images.shape[0]
orig_images = images

Expand Down

0 comments on commit 081d4cf

Please sign in to comment.