this function take an input and generate a output ragardign that input.
Suppose in image classification you will pass and input and in the end you will get a output from last (this is usual case in all the code forums.)
But what I am trying to say you can return any variable in forward function. Forward function is  just how each layer is being called and passed to next. so you can return output from any layer.