python attention_align_block.py
- 《Deep model with built-in self-attention alignment for acoustic echo cancellation》 https://arxiv.org/pdf/2208.11308.pdf
Deep model with built-in self-attention alignment for acoustic echo cancellation, Pytorch implement
License: MIT License
python attention_align_block.py
Thank you for open-sourcing the code for the align block module. This is very helpful for research on delayed alignment AEC. There seems to be an issue where an error occurs when t
is less than max_delay_blocks
in this code line.
Here is example:
def toy_train():
import matplotlib.pyplot as plt
C = 1
F = 64
T = 7
shift = 2
ref = torch.randn(1, C, F, T)
echo = torch.roll(ref, shifts=shift, dims=-1)
echo[:, :, :, :shift] = 0
mic = echo
layer = Attention_Align_Block(channels=C, fdim=F, pdim=64, max_delay_blocks=8)
optimizer = torch.optim.Adam(layer.parameters(), lr=0.01)
loss_fn = torch.nn.MSELoss()
for i in range(1000):
pred,_ = layer(mic, ref)
loss = loss_fn(pred, echo)
optimizer.zero_grad()
loss.backward()
optimizer.step()
if i %100 ==0:
print('loss: ', loss.item())
with torch.no_grad():
out, corr = layer(mic, ref)
plt.imshow(corr[0].detach().cpu().numpy().T)
plt.show()
Error information is here:
corr[:, :self.max_delay_blocks][mask] = self.neg_inf
IndexError: The shape of the mask [1, 8, 8] at index 1 does not match the shape of the indexed tensor [1, 7, 8] at index 1
你好
这篇文章的模型能实现一下吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.