How to megre intermediary outputs in forward

Hi,
I am confused how to megre all intermediary output in forward. In each loop, att1 have a shape (batch x 1 x 64 x64), i want pfeat have a shape (batch x num_parts x 64 x 64) .
When i run the below scipt.There comes the problem,AttributeError: ‘list’ object has no attribute 'size. How to fix this,Thanks for any help.

 def forward(self,x):
    
    pfeat = []
    if self.use_part is not None:
        for i in range(self.num_parts):
            att = self.attention(x)
            att1 = self.conv(att)
            pfeat.append(att)
        return pfeat 
            
    else:
        return self.attention(x)

you may use torch.cat()

http://pytorch.org/docs/master/torch.html?highlight=cat#torch.cat

I have tried torch.cat() and torch.stack(). But it doesn’t works.Maybe I have torch.cat misused.Thanks for your help.