Solved by ptrblck in post #2 
              
              
                You could create a Dataset, and load and transform your arrays there. 
Here is a small example: 
import torch
from torch.utils.data import Dataset, DataLoader

import numpy as np


class MyDataset(Dataset):
    def __init__(self, data, target, transform=None):
        self.data = torch.from_numpy(da…