So it means it will not always increase speed right.Okay and i am using cupy instead of numpy for faster processing while dataloading in pytorch.While i am using cupy i am getting following error.
Code i used to dataloading
  def __getitem__(self,index):
      if(torch.is_tensor(index)):
        index=index.tolist(index)
      input1=cp.array(Image.open(self.fg_bgimage[index]))
      input2=cp.array(Image.open(self.bg_image[index]))
      output1=cp.array(Image.open(self.mask_image[index]))
      output2=cp.array(Image.open(self.depth_image[index]))
      output2=output2.transpose(1,0)
      output1=self.return_binary(output1)
      if(self.transform):
        input1=self.transform[0](input1)
        input2=self.transform[1](input2)
        output1=self.transform[2](output1)
        output2=self.transform[3](output2)
      
      return input1,input2,output1,output2  
The calling function is :


import time

start=time.time()

i=0

pbar = tqdm_notebook(train_loader)

for data1,data2,target1,target2 in pbar:

  print(data1.shape)

  break

print(time.time()-start)

the error is 
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:4: TqdmDeprecationWarning: This function will be removed in tqdm==5.0.0
Please use `tqdm.notebook.tqdm` instead of `tqdm.tqdm_notebook`
  after removing the cwd from sys.path.
0%
0/8750 [00:00<?, ?it/s]
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-16-b126aa310636> in <module>()
      3 i=0
      4 pbar = tqdm_notebook(train_loader)
----> 5 for data1,data2,target1,target2 in pbar:
      6   print(data1.shape)
      7   break

5 frames
/usr/local/lib/python3.6/dist-packages/tqdm/notebook.py in __iter__(self, *args, **kwargs)
    213     def __iter__(self, *args, **kwargs):
    214         try:
--> 215             for obj in super(tqdm_notebook, self).__iter__(*args, **kwargs):
    216                 # return super(tqdm...) will not catch exception
    217                 yield obj

/usr/local/lib/python3.6/dist-packages/tqdm/std.py in __iter__(self)
   1102                 fp_write=getattr(self.fp, 'write', sys.stderr.write))
   1103 
-> 1104         for obj in iterable:
   1105             yield obj
   1106             # Update and possibly print the progressbar.

/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py in __next__(self)
    343 
    344     def __next__(self):
--> 345         data = self._next_data()
    346         self._num_yielded += 1
    347         if self._dataset_kind == _DatasetKind.Iterable and \

/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py in _next_data(self)
    854             else:
    855                 del self._task_info[idx]
--> 856                 return self._process_data(data)
    857 
    858     def _try_put_index(self):

/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py in _process_data(self, data)
    879         self._try_put_index()
    880         if isinstance(data, ExceptionWrapper):
--> 881             data.reraise()
    882         return data
    883 

/usr/local/lib/python3.6/dist-packages/torch/_utils.py in reraise(self)
    393             # (https://bugs.python.org/issue2651), so we work around it.
    394             msg = KeyErrorMessage(msg)
--> 395         raise self.exc_type(msg)

cupy/cuda/runtime.pyx in cupy.cuda.runtime.CUDARuntimeError.__init__()

TypeError: an integer is required


Thank you sir