This is almost exactly the same as this question:
  

      stackoverflow.com
  

  
      
    
  


  PyTorch data loading from multiple different-sized datasets 2



  python, pytorch



  asked by
  
  
    helium4
  
  on 08:33AM - 14 Aug 18 UTC


  

  
    
    
  

  


I have two datasets A and B. A contains tensors of shape [256,4096] and B contains tensors of shape [32,4096].
Now i can use ConcatDataset to merge A and B, but how do i guarantee that each batch only contains elements from either A or B.
Note, I don’t want to resize elements withing A and B. These are not images.
The answer on stack overflow mentions batch_sampler.
Can somebody elaborate and give a minimal example?