How to use F.linear without defining weights and biases?


I want to define a linear layer in my model (Conv layers followed by a linear layer), the input of which can be dynamic depending on the output of the last conv layer.
I want to know if using F.linear is the right way for that? Because the output of the last Conv layer can become the input of the linear layer but according to this torch.nn.functional.linear(input, weight, bias=None) I will need to define weights and biases for the same.

If there is any alternative for my problem, kindly please suggest.


If you use a Linear layer you have to use fixed input size. If you want to use variable input size you may use 1x1 convolutions