How to get output of a model by inserting feature vector to a specific layer?

Hello, I couldn’t find an answer.
Considering I have a model like resnet, and I would like to receive the output. But, instead of inserting a feature vector to the begining, I would like to insert the feature vector to a specific layer of the model. by this, I’m avoiding few starting layers of the network.
is it possible? without creating a new model?

Thanks in advance!

Depending on the architecture of the model you could either pass the new input to the desired modules directly:

model = ...
input = ...
output = model.last_block(input)

In case the architecture is not split into submodules and uses e.g. the functional API in its forward, I would recommend to write a new custom nn.Module and adapt the forward method as needed.