mythos.utils.helpers ==================== .. py:module:: mythos.utils.helpers .. autoapi-nested-parse:: Helper functions for the mythos package. Attributes ---------- .. autoapisummary:: mythos.utils.helpers.ERR_BATCHED_N Functions --------- .. autoapisummary:: mythos.utils.helpers.batched mythos.utils.helpers.tree_stack mythos.utils.helpers.tree_concatenate Module Contents --------------- .. py:data:: ERR_BATCHED_N :value: 'n must be at least one' .. py:function:: batched(iterable: collections.abc.Iterable[Any], n: int) -> collections.abc.Iterable[Any] Batch an iterable into chunks of size n. :param iterable: iterable to batch :type iterable: iter[Any] :param n: batch size :type n: int :returns: batched iterable :rtype: iter[Any] .. py:function:: tree_stack(trees: list[jaxtyping.PyTree]) -> jaxtyping.PyTree Stacks corresponding leaves of PyTrees into arrays along a new axis. .. py:function:: tree_concatenate(trees: list[jaxtyping.PyTree]) -> jaxtyping.PyTree Concatenates corresponding leaves of PyTrees along the first axis.