How to make the output of the previous layer flow into the next layer at a multiple

I want the input of each convolutional layer to be the output of its previous layer multiplied by an adaptive multiple. The model is ResNet50 in torchvision.models.
For example, there is a three layers CNN: Conv1, Conv2, Conv3.

The first iteration:
the_input_of_Conv2 =  1.31 * the_output_of_Conv1
the_input_of_Conv3 =  1.24 * the_output_of_Conv2 
The second iteration:
the_input_of_Conv2 =  1.40 * the_output_of_Conv1
the_input_of_Conv3 =  1.27 * the_output_of_Conv2 
The third iteration:
..............
and so on ......

The above figures 1.31, 1.24, 1.40 and 1.27 are just an example. The exact multiple can be calculated in the program.
Dose anyone know how to achieve this forward propagation?
Thanks!

I think the easiest way that would give you the most control over your model, would be to write it from scratch

class MyResnet2(models.ResNet):
    def __init__(self, block, layers, num_classes=1000):
        super().__init__(block, layers, num_classes)
        
    def forward(self, x):
        x = 1.41*self.conv1(x)
        x = self.bn1(x)

        return x

from torchvision.models.resnet import BasicBlock
model = MyResnet2(BasicBlock, [3, 4, 6, 3], 1000)

You have to do some basic imports of BasicBlock and Resnet. See the source code of Resnet in the torchvision github repo and you can easily modify the model.

Hello,

I think register_forward_pre_hook can help you, see more details here.