def mark_param_tensor(sorted_graph: List[Tensor]):
    """
    Mark constant tensors: those that have no ops
    *and* are not explicitly marked as inputs.

    Parameters
    ----------
    sorted_graph : List[Tensor]
        The graph to mutate.
    """

    for node in reversed(sorted_graph):
        if not node.src_ops() and not node._attrs["is_input"]:
            node._attrs["is_param"] = True

        view = node._attrs["is_view_of"]
        if view is not None:
            view._attrs["has_output_aliases"] = (
                node._attrs["is_output"] or node._attrs["has_output_aliases"]
            )

    Mark constant tensors: those that have no ops
    *and* are not explicitly marked as inputs.

    Parameters
    ----------
    sorted_graph : List[Tensor]
        The graph to mutate.
    
python/aitemplate/compiler/transform/mark_param_tensor.py