def _mark_isolated_int_vars(sorted_graph: List[Tensor]):
    """
    Mark the IntVars that are not present in any input's shape
    with the _attrs["isolated"] = True flag. The purpose is to
    be able to distinguish these dynamic dims in the codegen
    of some of the functions which should set them instead of
    relying on / validating the pre-set value. To this end,
    this function must be invoked right before the back-end
    code generation of the ops.

    One example is the padded_dense_to_jagged op that must set
    the total_length dimension of the resulting jagged Tensor
    if it hasn't been set from any of the model input's shape.
    Another example is the make_jagged op that should set the
    batch_dim within the JaggedIntVar of the resulting jagged
    Tensor, unless it has been set already from the inputs.
    """
    int_vars = {}
    int_var_names_in_input_shapes = set()
    for tensor in sorted_graph:
        for dim in tensor._attrs["shape"]:
            if not isinstance(dim, IntImm):
                name = dim._attrs["name"]
                int_vars[name] = dim
                if isinstance(dim, JaggedIntVar):
                    batch_dim = dim.batch_dim()
                    if not isinstance(batch_dim, IntImm):
                        int_vars[batch_dim._attrs["name"]] = batch_dim
                    total_length = dim.total_length()
                    int_vars[total_length._attrs["name"]] = total_length
                    for jagged_dim in dim.jagged_dims():
                        min_value = jagged_dim.min_value()
                        if not isinstance(min_value, IntImm):
                            int_vars[min_value._attrs["name"]] = min_value
                        max_value = jagged_dim.max_value()
                        if not isinstance(max_value, IntImm):
                            int_vars[max_value._attrs["name"]] = max_value
                if tensor._attrs["is_input"]:
                    int_var_names_in_input_shapes.add(name)

    for name, dim in int_vars.items():
        if name not in int_var_names_in_input_shapes:
            dim._attrs["isolated"] = True
Mark the IntVars that are not present in any input's shape
with the _attrs["isolated"] = True flag. The purpose is to
be able to distinguish these dynamic dims in the codegen
of some of the functions which should set them instead of
relying on / validating the pre-set value. To this end,
this function must be invoked right before the back-end
code generation of the ops.

One example is the padded_dense_to_jagged op that must set
the total_length dimension of the resulting jagged Tensor
if it hasn't been set from any of the model input's shape.
Another example is the make_jagged op that should set the
batch_dim within the JaggedIntVar of the resulting jagged
Tensor, unless it has been set already from the inputs.
python/aitemplate/compiler/compiler.py