@torch.no_grad()
def overlapped_chunk(self, noisy, inference_args):
    sr = self.acoustic_config['sr']
    noisy = noisy.squeeze(0)
    num_mics = 8
    chunk_length = (sr * inference_args['chunk_length'])
    chunk_hop_length = (chunk_length // 2)
    num_chunks = (int((noisy.shape[(- 1)] / chunk_hop_length)) + 1)
    win = torch.hann_window(chunk_length, device=noisy.device)
    prev = None
    enhanced = None
    for chunk_idx in range(num_chunks):
        if (chunk_idx == 0):
            pad = torch.zeros((num_mics, 256), device=noisy.device)
            chunk_start_position = (chunk_idx * chunk_hop_length)
            chunk_end_position = (chunk_start_position + chunk_length)
            noisy_chunk = torch.cat((pad, noisy[:, chunk_start_position:chunk_end_position]), dim=1)
            enhanced_chunk = self.model(noisy_chunk.unsqueeze(0))
            enhanced_chunk = torch.squeeze(enhanced_chunk)
            enhanced_chunk = enhanced_chunk[256:]
            cur = enhanced_chunk[:(chunk_length // 2)]
            prev = (enhanced_chunk[(chunk_length // 2):] * win[(chunk_length // 2):])
        else:
            pad = noisy[:, ((chunk_idx * chunk_hop_length) - 256):(chunk_idx * chunk_hop_length)]
            chunk_start_position = (chunk_idx * chunk_hop_length)
            chunk_end_position = (chunk_start_position + chunk_length)
            noisy_chunk = torch.cat((pad, noisy[:8, chunk_start_position:chunk_end_position]), dim=1)
            enhanced_chunk = self.model(noisy_chunk.unsqueeze(0))
            enhanced_chunk = torch.squeeze(enhanced_chunk)
            enhanced_chunk = enhanced_chunk[256:]
            enhanced_chunk = (enhanced_chunk * win[:len(enhanced_chunk)])
            tmp = enhanced_chunk[:(chunk_length // 2)]
            cur = (tmp[:min(len(tmp), len(prev))] + prev[:min(len(tmp), len(prev))])
            prev = enhanced_chunk[(chunk_length // 2):]
        if (enhanced is None):
            enhanced = cur
        else:
            enhanced = torch.cat((enhanced, cur), dim=0)
    enhanced = enhanced[:noisy.shape[1]]
    return enhanced.detach().squeeze(0).cpu().numpy()
@torch.no_grad()
def overlapped_chunk(self, noisy, inference_args):
    sr = self.acoustic_config['sr']
    noisy = noisy.squeeze(0)
    num_mics = 8
    chunk_length = (sr * inference_args['chunk_length'])
    chunk_hop_length = (chunk_length // 2)
    num_chunks = (int((noisy.shape[(- 1)] / chunk_hop_length)) + 1)
    win = torch.hann_window(chunk_length, device=noisy.device)
    prev = None
    enhanced = None
    for chunk_idx in range(num_chunks):
        if (chunk_idx == 0):
            pad = torch.zeros((num_mics, 256), device=noisy.device)
            chunk_start_position = (chunk_idx * chunk_hop_length)
            chunk_end_position = (chunk_start_position + chunk_length)
            noisy_chunk = torch.cat((pad, noisy[:, chunk_start_position:chunk_end_position]), dim=1)
            enhanced_chunk = self.model(noisy_chunk.unsqueeze(0))
            enhanced_chunk = torch.squeeze(enhanced_chunk)
            enhanced_chunk = enhanced_chunk[256:]
            cur = enhanced_chunk[:(chunk_length // 2)]
            prev = (enhanced_chunk[(chunk_length // 2):] * win[(chunk_length // 2):])
        else:
            pad = noisy[:, ((chunk_idx * chunk_hop_length) - 256):(chunk_idx * chunk_hop_length)]
            chunk_start_position = (chunk_idx * chunk_hop_length)
            chunk_end_position = (chunk_start_position + chunk_length)
            noisy_chunk = torch.cat((pad, noisy[:8, chunk_start_position:chunk_end_position]), dim=1)
            enhanced_chunk = self.model(noisy_chunk.unsqueeze(0))
            enhanced_chunk = torch.squeeze(enhanced_chunk)
            enhanced_chunk = enhanced_chunk[256:]
            enhanced_chunk = (enhanced_chunk * win[:len(enhanced_chunk)])
            tmp = enhanced_chunk[:(chunk_length // 2)]
            cur = (tmp[:min(len(tmp), len(prev))] + prev[:min(len(tmp), len(prev))])
            prev = enhanced_chunk[(chunk_length // 2):]
        if (enhanced is None):
            enhanced = cur
        else:
            enhanced = torch.cat((enhanced, cur), dim=0)
    enhanced = enhanced[:noisy.shape[1]]
    return enhanced.detach().squeeze(0).cpu().numpy()