def delete_asserts(tfssa):
    """
    Delete all nodes that lead only to assertions.
    """
    delete_count = 0
    for f in tfssa.functions.values():
        memo = {}
        for n in f.graph:
            _all_assert_leaves(f.graph, n, memo)
        for m in memo:
            if memo[m]:
                delete_count += 1
                delete_node(f.graph, m)
    logger.debug("%d assert nodes deleted", delete_count)
    return delete_count

    Delete all nodes that lead only to assertions.
    
coremltools/converters/mil/frontend/tensorflow/tf_graph_pass/delete_asserts.py