Solved by anantguptadbl in post #3 
              
              
                I have written a simple code 

import torch.utils.data as data
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim

class MyDataSet(torch.utils.data.Dataset):
    def __init__(self, numpyData,numpyTarget):
        self.data = numpyData
  …