Skip to content

Commit 130a55e

Browse files
committed
Fix tile_dot docstring referencing nonexistent wp.tensordot
* Fix tile_dot docstring referencing nonexistent wp.tensordot The "Equivalent to" line referred to wp.tensordot, which is not a Warp builtin. Rewrite the docstring to describe the contraction by element type (scalar, vector, matrix) and provide Python-level equivalents only where they actually exist. Signed-off-by: Eric Shi <ershi@nvidia.com> Approved-by: Eric Shi <ershi@nvidia.com> See merge request omniverse/warp!2311
1 parent 5017351 commit 130a55e

2 files changed

Lines changed: 24 additions & 14 deletions

File tree

warp/__init__.pyi

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3596,13 +3596,18 @@ def tile_sum(a: Tile[Any, tuple[int, ...]]) -> Tile[Any, tuple[Literal[1]]]:
35963596
def tile_dot(a: Tile[Any, tuple[int, ...]], b: Tile[Any, tuple[int, ...]]) -> Tile[Any, tuple[Literal[1]]]:
35973597
"""Compute the dot product of two tiles.
35983598
3599-
Computes a full contraction (tensordot) between corresponding elements
3600-
and sums the results. For scalar tiles this is the standard dot product;
3601-
for vector or matrix tiles each element pair is fully contracted
3602-
(e.g., ``wp.dot(a[i], b[i])`` for ``vec3`` elements).
3603-
3604-
Equivalent to ``wp.tile_sum(wp.tile_map(wp.tensordot, a, b))``
3605-
but without any intermediate tiles or shared-memory round trips.
3599+
Computes a full contraction between corresponding elements and sums
3600+
the results. For scalar tiles this is the standard dot product; for
3601+
vector tiles each pair is contracted via ``wp.dot``; for matrix tiles
3602+
it is the Frobenius inner product (the sum of element-wise products
3603+
over all axes).
3604+
3605+
Equivalent in Python to ``wp.tile_sum(a * b)`` for scalar tiles and to
3606+
``wp.tile_sum(wp.tile_map(wp.dot, a, b))`` for vector tiles, but
3607+
without the intermediate tile and shared-memory round trip the
3608+
explicit forms would require. Matrix-typed tiles have no
3609+
purely-elementwise Python equivalent because ``wp.dot`` is not
3610+
defined for matrices.
36063611
36073612
Args:
36083613
a: First tile operand.

warp/_src/builtins.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5337,13 +5337,18 @@ def tile_dot_value_func(arg_types, arg_values):
53375337
value_func=tile_dot_value_func,
53385338
doc="""Compute the dot product of two tiles.
53395339
5340-
Computes a full contraction (tensordot) between corresponding elements
5341-
and sums the results. For scalar tiles this is the standard dot product;
5342-
for vector or matrix tiles each element pair is fully contracted
5343-
(e.g., ``wp.dot(a[i], b[i])`` for ``vec3`` elements).
5344-
5345-
Equivalent to ``wp.tile_sum(wp.tile_map(wp.tensordot, a, b))``
5346-
but without any intermediate tiles or shared-memory round trips.
5340+
Computes a full contraction between corresponding elements and sums
5341+
the results. For scalar tiles this is the standard dot product; for
5342+
vector tiles each pair is contracted via ``wp.dot``; for matrix tiles
5343+
it is the Frobenius inner product (the sum of element-wise products
5344+
over all axes).
5345+
5346+
Equivalent in Python to ``wp.tile_sum(a * b)`` for scalar tiles and to
5347+
``wp.tile_sum(wp.tile_map(wp.dot, a, b))`` for vector tiles, but
5348+
without the intermediate tile and shared-memory round trip the
5349+
explicit forms would require. Matrix-typed tiles have no
5350+
purely-elementwise Python equivalent because ``wp.dot`` is not
5351+
defined for matrices.
53475352
53485353
Args:
53495354
a: First tile operand.

0 commit comments

Comments
 (0)