from pathlib import Path from aku import Aku aku = Aku() @aku.option def foo(a: int, b: bool = True, c: str = '3', d: float = 4.0, e: Path = Path.home()): print(f'a => {a}') print(f'b => {b}') print(f'c => {c}') print(f'd => {d}') print(f'e => {e}') @aku.option def add(x: int, y: int): print(f'{x} + {y} => {x + y}') aku.run()
from aku import Aku from benchmark.packing import pack_sequence, pack_padded_sequence from benchmark.padding import pad_sequence, pad_packed_sequence from benchmark.reduction import reduce_catted_sequences from benchmark.scatter import scatter_add, scatter_softmax, scatter_logsumexp, scatter_max, scatter_mul from benchmark.tree_reduction import tree_reduce_catted_sequence from benchmark.tree_reduction import tree_reduce_packed_sequence, tree_reduce_padded_sequence app = Aku() app.option(pack_sequence) app.option(pack_padded_sequence) app.option(pad_sequence) app.option(pad_packed_sequence) app.option(reduce_catted_sequences) app.option(tree_reduce_packed_sequence) app.option(tree_reduce_padded_sequence) app.option(tree_reduce_catted_sequence) app.option(scatter_add) app.option(scatter_mul) app.option(scatter_max) app.option(scatter_logsumexp) app.option(scatter_softmax) app.run()
from aku import Aku from torchglyph.hooks import summary aku = Aku() aku.option(summary) aku.run()
from pathlib import Path from typing import Union from aku import Aku, Literal aku = Aku() @aku.option def foo(x: int, y: str = '4', z: bool = True, w: Path = Path.home(), **kwargs): print(f'{foo.__name__}.x => {x}') print(f'{foo.__name__}.y => {y}') print(f'{foo.__name__}.z => {z}') print(f'{foo.__name__}.w => {w}') if '@aku' in kwargs: print(f'{foo.__name__}.@aku => {kwargs["@aku"]}') @aku.option def bar(x: Literal[1, 2, 3] = 2, y: list[int] = [2, 3, 4], z: tuple[float, ...] = (), w: tuple[float, str, int] = (1., '2', 3), **kwargs): print(f'{bar.__name__}.x => {x}') print(f'{bar.__name__}.y => {y}') print(f'{bar.__name__}.z => {z}') print(f'{bar.__name__}.w => {w}') if '@aku' in kwargs: print(f'{bar.__name__}.@aku => {kwargs["@aku"]}') @aku.option def delegate(call: type[foo]):