IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Python function

assert_all_close

assert_all_close()​

max.experimental.testing.assert_all_close(t1, t2, atol=1e-06, rtol=1e-06)

source

Asserts two tensors are elementwise close within the given tolerances.

Parameters:

  • t1 (DLPackArray | Sequence[float | number[Any] | Sequence[Number | NestedArray]] | float | number[Any]) – The expected value. Converted to a Tensor matching t2’s dtype and device if it is not already one.
  • t2 (Tensor) – The actual Tensor to compare against.
  • atol (float) – The maximum allowed absolute difference.
  • rtol (float) – The maximum allowed relative difference.

Raises:

AssertionError – If any element exceeds atol or rtol.

Return type:

None