def assert_all_tensors_reachable(self, sess, outputs):
    """Checks that all the tensors in the graph are reachable from outputs."""

    ignore_strings = [
        "^.*/assert_less_equal/.*$",
        "^.*/dilation_rate$",
        "^.*/Tensordot/concat$",
        "^.*/Tensordot/concat/axis$",
        "^testing/.*$",
        # TensorContracts:
        "^Require.*$",
        "^Ensure.*$",
        "^Assert.*$",
        "^Identity.*$",
        "^ExpandDims.*$",
        "^Squeeze.*$",
        "^.*Const.*$",
        "^MaxPool2d.*$",
        "^.*Repeat.*shape$",
        "^ones.*$",
        "^concat.*$",
    ]
    ignore_pattern = "|".join(ignore_strings)
    ignore_regex = re.compile(ignore_pattern)
    unreachable = get_unreachable_ops(sess.graph, outputs)
    unreachable = [x for x in unreachable if not ignore_regex.match(x.name)]
    self.assertEmpty(
        unreachable, "The following ops are unreachable: {}".format(" ".join(
            x.name for x in unreachable)))
Checks that all the tensors in the graph are reachable from outputs.
language/canine/modeling_test.py