Hi @Xia_Zhengmi
First of all the intermediate level might not have the same input size as the first level, I’d propose to check the input of your layer_of_interest with pre forward hook that outputs the size of input.
def print_input_size(self, input):
  print('Inside ' + self.__class__.__name__ + 'pre forward')
  print(input.shape)

net.layer_of_interest.register_forward_pre_hook(print_input_size)

Secondly, you can shorten your model using Python slicing and nn.Sequential (this option will work only if your net is already a Sequential, if not find a container in it and slice it)
from = 3 # number of layer_of_interest
new_net = nn.Sequential(*net[from:])

Hope that will help!