def symb_forward(self, symb_input):
        # If no `wrt` is passed, we use the referenced module's graph and go
        # through it backwards, using all its parameters etc.
        if self.wrt is None:
            try:
                start = self.modules[0]._last_symb_inp[self._mode]
                end   = self.modules[0]._last_symb_out[self._mode]
            except KeyError:
                raise ValueError("The module contained by `Backward` needs to occur first in the graph!")

        # But if `wrt` is passed, we call `symb_forward` of the referenced
        # module with the input that `wrt` had gotten, in order to create a
        # new graph through which we then go backwards.
        else:
            try:
                start = self.wrt._last_symb_inp[self._mode]
            except __HOLE__:
                raise ValueError("The module referenced by `Backward`'s `wrt` argument needs to occur first in the graph!")
            end = self.modules[0](start)

        end = df.utils.flatten(end)
        inp = df.utils.flatten(symb_input)

        # Match all "backward outputs" with inputs here.
        assert len(end) == len(inp), "Need same number of inputs to `Backward` as contained module has outputs ({})".format(len(end))
        known_grads = dict(zip(end, inp))

        # Go backwards for each "backward input" which then becomes output here.
        if isinstance(start, (list, tuple)):
            return [df.th.grad(None, wrt=s, known_grads=known_grads) for s in start]
        else:
            return df.th.grad(None, wrt=start, known_grads=known_grads)
dataset/ETHPy150Open lucasb-eyer/DeepFried2/DeepFried2/containers/Backward.py/Backward.symb_forward