def can_be_constant_folded(tensors: Union[Tensor, List[Tensor]]):
    """
    Check if a tensor or a list of tensors can be folded as a constant
    """
    visited = {}
    if isinstance(tensors, Tensor):
        tensors = [tensors]
    for t in tensors:
        _can_be_constant_folded(t, visited)
        if not visited[t]:
            return False
    return True

    Check if a tensor or a list of tensors can be folded as a constant
    
python/aitemplate/compiler/transform/transform_utils.py