Maybe I’m misunderstanding your use case completely, so feel free to correct me. 
You’ve said



 ivan-bilan:

I need to multiply it with a weight vector of size [240]


, but somehow you are trying to initialize a tensor of shape [240, 240] as my_weights.
If you just want random numbers, you can reuse my code example: my_weights = nn.Parameter(torch.randn(1, 1, 1, 240)).