writing a custom dataset to pytorch
I am having data of numpy arrays with shape (400, 46, 55, 46) here 400 are the samples and 46,55,46 is the image.350 samples for training and remaining 50 for validation
np.max(data[1]), np.min(data[1]), len(data[1])
Output: (2941.0, -43.0, 46)

Now i want to load the data into pytorch model for that i need to write a custom dataloader as i am new to pytorch i am finding hard to wrie can someone help

You can use a combination of torch.utils.data.TensorData and torch.utils.data.random_split to construct the two datasets and wrap them with torch.utils.data.DataLoader:
&gt;&gt;&gt; data = np.random.rand(400, 46, 55, 46)

# Datasets initialization
&gt;&gt;&gt; ds = TensorDataset(torch.from_numpy(data))
&gt;&gt;&gt; train_ds, valid_ds = random_split(ds, (350, 50))

# Dataloader wrappers
&gt;&gt;&gt; train_dl, valid_dl = DataLoader(train_ds), DataLoader(valid_ds)

