Rate this Page

torch.fx.experimental.symbolic_shapes.guard_scalar#

torch.fx.experimental.symbolic_shapes.guard_scalar(a)[source]#

Guard a scalar value, which can be a symbolic or concrete boolean, integer, or float.

This function dispatches to the appropriate guard function based on the type of the input.

Parameters:

a (SymBool | SymInt | SymFloat | int | bool | float) – A symbolic or concrete scalar value (bool, int, or float)

Returns:

The concrete value after guarding

Raises:

AssertionError – If the input is not a recognized scalar type

Return type:

bool | int | float