From 218047c75a6826789c5f0e5d7ac5d319a1bd0a34 Mon Sep 17 00:00:00 2001 From: Awni Hannun Date: Thu, 11 Jul 2024 15:59:07 -0700 Subject: [PATCH] docs fixes (#1263) --- docs/src/python/array.rst | 2 ++ python/src/ops.cpp | 17 +++++++++-------- python/src/transforms.cpp | 6 +++--- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/docs/src/python/array.rst b/docs/src/python/array.rst index 9946f3529..440167ba4 100644 --- a/docs/src/python/array.rst +++ b/docs/src/python/array.rst @@ -24,6 +24,7 @@ Array array.any array.argmax array.argmin + array.conj array.cos array.cummax array.cummin @@ -57,3 +58,4 @@ Array array.transpose array.T array.var + array.view diff --git a/python/src/ops.cpp b/python/src/ops.cpp index e2412b44d..ee0941aca 100644 --- a/python/src/ops.cpp +++ b/python/src/ops.cpp @@ -2559,7 +2559,7 @@ void init_ops(nb::module_& m) { If unspecified, it defaults to ``-1``. Returns: - array: The `uint32`` array containing indices that partition the input. + array: The ``uint32`` array containing indices that partition the input. )pbdoc"); m.def( "topk", @@ -4388,20 +4388,21 @@ void init_ops(nb::module_& m) { Perform the Walsh-Hadamard transform along the final axis. Equivalent to: - ```python - from scipy.linalg import hadamard - y = hadamard(len(x)) @ x - ``` + .. code-block:: python + + from scipy.linalg import hadamard - Supports sizes `n = m*2^k` where m in (1, 12, 20, 28) - and 2^k <= 8192 for FP32 and 2^k <= 16384 for FP16/BF16. + y = hadamard(len(x)) @ x + + Supports sizes ``n = m*2^k`` for ``m`` in ``(1, 12, 20, 28)`` and ``2^k + <= 8192`` for float32 and ``2^k <= 16384`` for float16/bfloat16. Args: a (array): Input array or scalar. scale (float): Scale the output by this factor. Returns: - array: The array with the new type. + array: The transformed array. )pbdoc"); } diff --git a/python/src/transforms.cpp b/python/src/transforms.cpp index e5acf94e4..e793ed598 100644 --- a/python/src/transforms.cpp +++ b/python/src/transforms.cpp @@ -934,9 +934,9 @@ void init_transforms(nb::module_& m) { This class is meant to be used as a function decorator. Instances are callables that behave identically to the wrapped function. However, when a function transformation is used (e.g. computing gradients using - :func:`value_and_grad`) then the functions defined via :method:`vjp`, - :method:`jvp` and :method:`vmap` are used instead of the default - transformation. + :func:`value_and_grad`) then the functions defined via + :meth:`custom_function.vjp`, :meth:`custom_function.jvp` and + :meth:`custom_function.vmap` are used instead of the default transformation. Note, all custom transformations are optional. Undefined transformations fall back to the default behaviour.