title: How to filter tensor shape during creating dataset in pytorch?
body: <p>I have loaded the 1 second audio files in a tensor format and most of them have the [1,22050]  tensor size. But several audio files have smaller sizes such as [1,3042] and I want to get rid of them. How to make filter during loading the audio files in a custom dataset?</p>
  <p>here is my code:</p>
  <pre><code>data_waveform, rate_of_sample = torchaudio.load(audio_file)
          
          if data_waveform.shape ==[1,22050]:
              sound_data = data_waveform
          else: 
              pass
      
          
              sample = {'audio_file': sound_data, 'labels': label}
  
          if self.transform:
              sample = self.transform(sample)
  
          return sample
  </code></pre>
  <p>But I am getting the error message such as &quot;UnboundLocalError: local variable 'sound_data' referenced before assignment&quot;. How to create tensor size checker for loading only correct sized tensors?</p>