コード例 #1
0
    def outputs(self):
        """
        A dictionary of all output ops as "name:op" pairs

        Notes:
            Outputs are defined as matching 1 of 2 criteria:
                1. Ops in the subgraph that aren't depended on by any other ops in the subgraph
                2. Not a variable or placeholder op
        """
        op_args = OrderedSet()
        ops = OrderedSet()
        for op in self:
            if isinstance(op, ng.AssignableTensorOp):
                continue
            ops.add(op)
            for arg_op in op.args + tuple(op.control_deps):
                op_args.add(arg_op)

        return OrderedDict((op.name, op) for op in ops.difference(op_args))