Received correct answer on my local machine, while google colab did not send correct answer

Ghasem_Abdi: <p>Hi,</p>
<p>I developed the following code to concatenate two data together. I received correct answer on my local machine, while google colab did not send correct answer. Please advice</p>
<pre><code class="lang-auto">class ConcatDataset(Dataset):
  def __init__(self, x1, x2, y): self.x1, self.x2, self.y = x1, x2, y
  def __len__(self): return len(self.y)
  def __getitem__(self, i): return (self.x1[i], self.x2[i]), self.y[i]

#concatenate base and target dataset
train_ds = ConcatDataset(x1_train, x2_train, y_train)
valid_ds = ConcatDataset(x1_valid, x2_valid, y_valid)

#create training and validation data loaders from train and valid dataset
train_dl = DataLoader(train_ds, batch_size=2)
valid_dl = DataLoader(valid_ds, batch_size=2)

#create train data bunch from training and validation data loaders
data_train = DataBunch(train_dl, valid_dl)

from torchvision.utils import make_grid
def imshow(inp): plt.imshow(np.clip(inp.numpy().transpose((1, 2, 0)), 0, 1))
(x1, x2), y = next(iter(data_train.train_dl)); concat = torch.cat((x1, x2), 0); plt.figure(figsize = (24, 9)); imshow(make_grid(concat, nrow=2))
</code></pre>
<p>Google Colab Concatenation Sample Result (Wrong Concatenation):<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/1/5/15a52852be2b803297312a73fcc3651e393451af.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/15a52852be2b803297312a73fcc3651e393451af" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/1/5/15a52852be2b803297312a73fcc3651e393451af_2_504x500.jpeg" alt="image" data-base62-sha1="35tSgkZs6uLLLAvl1AXi6pYhbVt" width="504" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/1/5/15a52852be2b803297312a73fcc3651e393451af_2_504x500.jpeg, https://discuss.pytorch.org/uploads/default/original/3X/1/5/15a52852be2b803297312a73fcc3651e393451af.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/1/5/15a52852be2b803297312a73fcc3651e393451af.jpeg 2x" data-dominant-color="6E6E70"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">529×524 87.9 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>My Local Machine Concatenation Sample Result (Correct Concatenation):<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/6/8/68685dba71b05f09d654b841e19d524e828881d7.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/68685dba71b05f09d654b841e19d524e828881d7" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/6/8/68685dba71b05f09d654b841e19d524e828881d7_2_504x500.jpeg" alt="image" data-base62-sha1="eTDg8FIVzOhv3yHycGYi9RKndAz" width="504" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/6/8/68685dba71b05f09d654b841e19d524e828881d7_2_504x500.jpeg, https://discuss.pytorch.org/uploads/default/original/3X/6/8/68685dba71b05f09d654b841e19d524e828881d7.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/6/8/68685dba71b05f09d654b841e19d524e828881d7.jpeg 2x" data-dominant-color="5E5C5E"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">529×524 99.1 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

Ghasem_Abdi: <p><a class="mention" href="/u/ptrblck">@ptrblck</a></p>
<p>Hi: Do you have any idea why this happened?</p>

ptrblck: <p>I don’t understand the use case completely.<br>
It seems you are trying to concatenate the output of two different loaders.<br>
Are you using any random transformations, such as flipping or rotation?<br>
What would the expected output be?</p>

Ghasem_Abdi: <p>Yes, I am trying to concatenate two data loaders and do not use any augmentation rule.<br>
The problem is that the code works well on my pc, while the same code does not correctly work in google colab. The output has to be concatenated dataset.</p>

Ghasem_Abdi: <p>We should upload the data as zip file in google drive, because uploading the images may cause that problem for dataloaders.</p>