Fixing a bug of DynamicConv in the unfolding mode (#593)
Summary: The unfold1d.py has the same name as the function `unfold1d` function, which will cause an error when using DynamicConv1dTBC with `unfold=True`. This doesn't affect the NMT models which don't use the unfolding mode though. I rename `unfold1d.py` as `unfold.py` to fix this bug. Originally we would get `TypeError` when running this code: ``` import torch from fairseq.modules import LightweightConv1dTBC, DynamicConv1dTBC x = torch.rand(4, 10, 8) m = LightweightConv1dTBC(8, 4, 3) o = m(x, unfold=True) m = DynamicConv1dTBC(8, 4, 3) o = m(x, unfold=True) ``` Pull Request resolved: https://github.com/pytorch/fairseq/pull/593 Differential Revision: D14597117 Pulled By: myleott fbshipit-source-id: 59752fd7ff62c53a4aba8b56b83155291e5f5792
Showing
Please register or sign in to comment