x1 = np.array([1,2,3]) isn’t a Dataset as properly defined by PyTorch. Actually, Dataset is just a very simple abstract class (pure Python) 39.
Indeed, the snippet below works as expected, i.e., it will sample correctly:
import torch
import numpy as np
x = np.arange(6)
d = DataLoader(x, batch_size=2)
for e in d:print(e)

It works mainly because the methods __len__ and __getitem__ are well defined for numpy arrays. The __add__ method is implemented too, but it doesn’t perform concatenation. Maybe the snippet below will make it clear:
import torch
from torch.utils.data import Dataset, DataLoader

class NpDataset(Dataset):
  def __init__(self, array):
    self.array = array
  def __len__(self): return len(self.array)
  def __getitem__(self, i): return self.array[i]

x = np.arange(3)
y = np.arange(3, 6)

data_x = NpDataset(x)
data_y = NpDataset(y)

for e in DataLoader(x + y, batch_size=1):print(e) # prints 3, 5, 7

for e in DataLoader(data_x + data_y, batch_size=1):print(e) # prints 0, 1, 2, 3, 4, 5