Should you advice, how to replace some block of channels with mean values?
And perform it independly for each sample in batch.
Im not sure how to select indexes over batch and len axis at the same time.
For x = torch.rand(32, 1024, 128)
def mean_freq_mask(x, p=0.2):
	if torch.rand(1) < p:
		x = x.clone()
		batch_size, length, features = x.size()
		F = features // 3
		mean = x.detach().mean(2)
		mask_len = (torch.rand(batch_size)*F).long()
		mask_start = (torch.rand(batch_size)*(features-F)).long()
		x[mask_start:mask_start+mask_len] = mean.unsqueeze(-1).expand(-1, -1, features)[mask_start:mask_start+mask_len]
	return x

This gives error only integer tensors of a single element can be converted to an index