Concatenate parameter and tensor in pytorch

It is an RNN type of structure. Because of the question setting, it is reasonable to make the initial value of the hidden state to be a concatenation of tensor and parameters. For the tensor part, the initial value is known, and for the parameter part, it is trainable. I try to parameter and tensor, and it seems not possible.


Error message

TypeError                                 Traceback (most recent call last)
<ipython-input-34-1f7bbc984497> in <module>
      2 hidden_train=torch.zeros(1,1,3)
      3 hidden_train=nn.Parameter(hidden_train,requires_grad=True)
----> 4,initialvec)

TypeError: cat(): argument 'tensors' (position 1) must be tuple of Tensors, not Parameter

What’s a good way to concatenate a parameter and tensor?

Thank you.

Hi, takes a tuple as input, not multiple parameters:[hidden_train,initialvec] dim=X) in your case :smiley:

Thank you. Sorry I didn’t realize the grammar error ;->