rand module
Hash
|
1D XQO-style hash for PyTorch. |
|
2D XQO-style hash for PyTorch. |
|
2D normalized UV hash for PyTorch. |
|
2D denormalized XY hash for PyTorch. |
|
1D XQO-style hash for NumPy. |
|
2D XQO-style hash for NumPy. |
Scramble
|
2D value noise scramble. |
|
3D value noise scramble. |
- tinytex.rand.pt_hash_uint(x, normalize=False)[source]
1D XQO-style hash for PyTorch.
- Parameters:
x (torch.Tensor) – Input int tensor.
normalize (bool) – If True, returns float32 values in [0, 1].
- Returns:
Hashed tensor (uint32 or float32).
- Return type:
torch.Tensor
- tinytex.rand.pt_hash2_uint(x, y, normalize=False)[source]
2D XQO-style hash for PyTorch.
- Parameters:
x (torch.Tensor) – X coordinates (int tensor).
y (torch.Tensor) – Y coordinates (int tensor).
normalize (bool) – If True, returns float32 in [0, 1].
- Returns:
Hashed values (uint32 or float32).
- Return type:
torch.Tensor
- tinytex.rand.pt_hash2_uv(uv, seed=0, tile_size=1023)[source]
2D normalized UV hash for PyTorch. Expects normalized coordinates. Produces uniform pseudo-random values.
- Parameters:
uv (torch.Tensor) – Tensor of shape [2, H, W] with values in [0, 1].
seed (int) – Optional seed for scrambling.
tile_size (int) – Maximum tile size (default: 1023).
- Returns:
Tensor of shape [H, W] with float32 values in [0, 1].
- Return type:
torch.Tensor
- tinytex.rand.pt_hash2_xy(xy, seed=0, tile_size=1023)[source]
2D denormalized XY hash for PyTorch. Expects denormalized integer coordinates. Produces uniform pseudo-random values.
- Parameters:
xy (torch.Tensor) – Tensor of shape [2, H, W] with integer coordinates.
seed (int) – Optional seed for scrambling.
tile_size (int) – Maximum tile size (default: 1023).
- Returns:
Tensor of shape [H, W] with float32 values in [0, 1].
- Return type:
torch.Tensor
- tinytex.rand.np_hash_uint(x, normalize=False)[source]
1D XQO-style hash for NumPy.
- Parameters:
x (ndarray) – Input array (uint32-compatible).
normalize (bool) – If True, returns float32 values in [0, 1].
- Returns:
Hashed values (uint32 or float32).
- Return type:
ndarray
- tinytex.rand.np_hash2_uint(x, y, normalize=False)[source]
2D XQO-style hash for NumPy.
- Parameters:
x (ndarray) – X array (uint32-compatible).
y (ndarray) – Y array (uint32-compatible).
normalize – If True, returns float32 values in [0, 1].
- Returns:
Hashed values (uint32 or float32).
- Return type:
ndarray