Skip to content

Commit

Permalink
Update image.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ASEM000 committed Aug 7, 2023
1 parent 9b1a380 commit 39e8972
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions serket/nn/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,6 @@ class RandomPerspective2D(sk.TreeClass):
>>> import serket as sk
>>> import jax.numpy as jnp
>>> import jax
>>> layer = sk.nn.RandomPerspective2D(100)
>>> x, y = jnp.meshgrid(jnp.linspace(-1, 1, 30), jnp.linspace(-1, 1, 30))
>>> d = jnp.sqrt(x**2 + y**2)
>>> mask = d < 1
Expand Down Expand Up @@ -864,7 +863,9 @@ class RandomPerspective2D(sk.TreeClass):
[0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]]
>>> out = layer(mask[None], key=jax.random.PRNGKey(10))[0]
>>> layer = sk.nn.RandomPerspective2D(100)
>>> key = jax.random.PRNGKey(10)
>>> out = layer(mask[None], key=key)[0]
>>> print(out.astype(int))
[[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0]
Expand Down

0 comments on commit 39e8972

Please sign in to comment.