Skip to main content
Log in

Mojo function

compatible

compatible(a: IntTuple[origin], b: IntTuple[origin]) -> 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[origin]): The first IntTuple to compare.
  • b (IntTuple[origin]): The second IntTuple to compare.

Returns:

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