Kind of a rought way to detect residual connection could be -
def forward(self, x):
    self.out = self.layers(x)
    return x + self.out

outputs = model(features)
if (outputs - model.out).abs().mean() == model.layers(features).abs().mean():
   print('there is a residual connection')

Again not a reccomended way but should work in this particular example.