I have two tensors that were splitted for data preprocessing purposes. Together with their original indices in an unsplitted state, how do I merge them back without creating significantly large new memory and merge merge them back, like so:
a = torch.rand((5, 3, 500, 500))
b = torch.rand((6, 3, 500, 500))
a_indices = [1, 5, 7, 8, 9]
b_indices = [0, 2, 3, 4, 6, 10]
merge = torch.zeros((11, 3, 500, 500)) # any idea how to skip this since it create memory allocation? Maybe by expanding `a` then merge `b` into it?
merge[a_indices] = a
merge[b_indices] = b
Any idea how to work around this?