MCPcopy Create free account
hub / github.com/apple/axlearn / check_numerics

Function check_numerics

axlearn/common/utils.py:359–364  ·  view source on GitHub ↗

Checks that all elements in `x` are finite.

(x: Tensor, msg_fmt: str = "", **msg_kwargs)

Source from the content-addressed store, hash-verified

357
358
359def check_numerics(x: Tensor, msg_fmt: str = "", **msg_kwargs):
360 """Checks that all elements in `x` are finite."""
361 global _enable_numeric_checks # pylint: disable=global-statement,global-variable-not-assigned
362 if _enable_numeric_checks:
363 assert bool(jnp.isfinite(x).all()), f"Check numerics {msg_fmt.format(**msg_kwargs)}: {x}"
364 return x
365
366
367def shapes(nested_tensor: NestedTensor) -> NestedTree:

Callers 2

softmax_with_biasesFunction · 0.90
sigmoid_with_biasesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected