Lasagne.layers.get_output equivalent method in pytorch

Hello,
I stuck in method lasagne.layers.get_output (https://lasagne.readthedocs.io/en/latest/user/layers.html) in Theano library. Could you explain what is similar function of that in PyTorch?

l_in = lasagne.layers.InputLayer(
        shape=(None, 1, input_height, input_width),
    )

    l_hid = lasagne.layers.DenseLayer(
        l_in,
        num_units=20,
        # nonlinearity=lasagne.nonlinearities.tanh,
        nonlinearity=lasagne.nonlinearities.rectify,
        # W=lasagne.init.Normal(.0201),
        W=lasagne.init.Normal(.01),
        b=lasagne.init.Constant(0)
    )

    l_out = lasagne.layers.DenseLayer(
        l_hid,
        num_units=output_length,
        nonlinearity=lasagne.nonlinearities.softmax,
        # W=lasagne.init.Normal(.0001),
        W=lasagne.init.Normal(.01),
        b=lasagne.init.Constant(0)
    )
    return l_out
prob_act = lasagne.layers.get_output(self.l_out, states)
prob_act[T.arange(N), actions]

You could use forward hooks to get the output activations of specific layers as seen in this post.
Alternatively you could also return the intermediate activations from some layers directly in your forward method (if you are using a custom model).

Let me know, if this would work.

I think this suggestion will be my answer, but why didn’t I think of this? :sweat_smile: