The DataParallel function distributes the batch_size evenly to each GPU, and then each GPU processes the allocated data, but in my program, I need to re-integrate an intermediate output variable, that is, firstly， aggregate this variable from all GPUs. Then use the Tensor.view() function to re-integrate the data, and finally distribute the integrated data to each GPU again. Every time I do this, the program will report an error. Is there a solution?
x = x.view(self.batch_size * self.num_segments, 3, 224, 224)
RuntimeError: shape ‘[12, 3, 224, 224]’ is invalid for input of size 602112