This repository has been archived by the owner on May 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56b4e31
commit 1478ab7
Showing
4 changed files
with
46 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
def jax_gather_nd(params, indices): | ||
from jaxtyping import Num, Array, Int | ||
|
||
|
||
def jax_gather_nd( | ||
params: Num[Array, "N ..."], indices: Int[Array, "M"] | ||
) -> Num[Array, "M ..."]: | ||
"""Slice a `params` array at a set of `indices`. | ||
Args: | ||
params (Num[Array]): An arbitrary array with leading axes of length `N` upon which we shall slice. | ||
indices (Float[Int]): An integer array of length M with values in the range [0, N) whose value at index `i` will be used to slice `params` at index `i`. | ||
Returns: | ||
Num[Array: An arbitrary array with leading axes of length `M`. | ||
""" | ||
tuple_indices = tuple(indices[..., i] for i in range(indices.shape[-1])) | ||
return params[tuple_indices] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from .linear import Linear | ||
from .polynomial import Polynomial | ||
from .white import White | ||
from ..stationary.white import White | ||
|
||
__all__ = ["Linear", "Polynomial", "White"] |
14 changes: 11 additions & 3 deletions
14
jaxkern/nonstationary/white.py → jaxkern/stationary/white.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters