I want to extend a tensor in PyTorch in the following way:
Let C
be a 3x4
tensor which requires_grad = True
. I want to have a new C
which is 3x5
tensor and C = [C, ones(3,1)]
(the last column is a one-vector, and others are the old C
)
Moreover, I need requires_grad = True
for new C
.
What is an efficient way to do this?