def fetch_variables(self):
        """
        WRITEME

        Fills the inputs, outputs, variables, orphans, temps and node_order
        fields.

        """
        fgraph = self.fgraph
        self.inputs = fgraph.inputs
        self.outputs = fgraph.outputs

        self.node_order = self.schedule(fgraph)

        # list(fgraph.variables)
        # We need to include the unused inputs in our variables,
        # otherwise we can't pass them to the module.
        self.variables = [var for var in self.inputs if not len(var.clients)]
        self.variables += graph.variables(self.inputs, self.outputs)

        # This adds a hidden input which is the params for each node
        # that needs it
        self.node_params = dict()
        for node in self.node_order:
            params = node.run_params()
            if params is not graph.NoParams:
                # try to avoid creating more than one variable for the
                # same params.
                if params in self.node_params:
                    var = self.node_params[params]
                    assert var.type == node.params_type
                    var.clients.append((node, 'params'))
                else:
                    var = graph.Constant(node.params_type, params)
                    var.clients = [(node, 'params')]
                    self.node_params[params] = var
                    self.variables.append(var)

        # The orphans field is listified to ensure a consistent order.
        # list(fgraph.orphans.difference(self.outputs))
        self.orphans = list(r for r in self.variables
                            if isinstance(r, graph.Constant) and
                            r not in self.inputs)
        # C type constants (theano.scalar.Scalar). They don't request an object
        self.consts = []
        # Move c type from orphans (theano.scalar.Scalar) to self.consts
        for variable in self.orphans:
            if isinstance(variable, graph.Constant):
                try:
                    variable.type.c_literal(variable.data)
                    self.consts.append(variable)
                    self.orphans.remove(variable)
                except (utils.MethodNotDefined, __HOLE__):
                    pass

        self.temps = list(set(self.variables).difference(
            self.inputs).difference(self.outputs).difference(self.orphans))
dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/gof/cc.py/CLinker.fetch_variables