IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo function

compatible

def compatible(a: IntTuple, b: IntTuple) -> Bool

Test if two shapes are compatible for tensor operations.

This function checks if shape A is compatible with shape B, meaning:

  1. The total size of A and B are the same
  2. Any coordinate into A can also be used as a coordinate into B

Compatible can also be thought of as a partial order on A and B: A <= B.

Args:

  • a (IntTuple): The first IntTuple to compare.
  • b (IntTuple): The second IntTuple to compare.

Returns:

Bool: True if shape A is compatible with shape B, False otherwise.

Was this page helpful?