Do pytorch supoort the collection of “operations” to do during a single forward pass?
For instance:
class MyModel(nn.Module):
    def __init__(self, args):
        ... some setup here

    def common_operation(self, x):
        ...
        return common_val
    
    def operation1(self, x):
        tmp = common_operation(x)
        ... some computation
        return val1

    def operation2(self, x):
        tmp = common_operation(x)
        ... some computation
        return val2

model = MyModel(...)
model.operation1(x)
model.operation2(x)

Is it possible for torch to reuse values computed during operation1 when computing operation2 if the inputs are the same? Other than say returning them from an operation3 that combines 1 and 2? IK this is more like a tensorflow thing with static computation graph. But are intermediate values stored and can they be somewhat reused?
Thanks.