I have a 2D matrix of activation values for every image. I want to made up 1D activation vectors corresponding to each image. I am not sure how to do it. Any help regarding this would be great.
Is this topic related to distributed?
Anyway, could you give us more details about the activation value?
Describing it with a dimension would be helpful.
I updated the category. Thanks for indicating.
The activation values are the logits. The dimension is 8749 rows × 11 columns.
There are several ways to make the tensor flatten.
Among them, in this case,

nn.Flatten
would be the one you are looking for.
(Flatten — PyTorch 1.12 documentation) 
tensor.view()
is the popular option.activation_vector.view(batch_size, 1)
makes the tensor flatten.
For any case, keep in mind that your tensor should have at least 2D which indicates the size of batch in the first dimension.