def custom_equals(item, other) -> bool:
    """
    Helper function allowing to test if two items are equal.
    The function is called recursively if the items are lists or tuples and
     it uses `torch.equal` if the two items to compare are Tensors.
    """
    if type(item) != type(other):
        return False
    if isinstance(item, (tuple, list)):
        if len(item) != len(other):
            return False
        return all(custom_equals(*elts) for elts in zip(item, other))
    if isinstance(item, torch.Tensor):
        return torch.equal(item, other)
    return item == other

    Helper function allowing to test if two items are equal.
    The function is called recursively if the items are lists or tuples and
     it uses `torch.equal` if the two items to compare are Tensors.
    
tests/benchmarks/classic/test_ctrl.py