Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conv Transposed + Layer Norm = "RuntimeError: columns needs to be contiguous" #33168

Closed
PetrochukM opened this issue Feb 11, 2020 · 5 comments
Closed
Assignees
Labels
module: cpu CPU specific problem (e.g., perf, algorithm) triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@PetrochukM
Copy link

PetrochukM commented Feb 11, 2020

馃悰 Bug

I'm unable to run layer normalization after a transposed convolution in PyTorch 1.4.

To Reproduce

import torch

in_channels = 64
out_channels = 128
scale_factor = 8
batch_size = 8
length = 16

conv = torch.nn.ConvTranspose1d(
    in_channels, out_channels, kernel_size=scale_factor * 2, stride=scale_factor)
layer_norm = torch.nn.LayerNorm(out_channels)

input_ = torch.randn(batch_size, in_channels, length).contiguous()
input_ = conv(input_).contiguous()
input_ = layer_norm(input_.transpose(1, 2).contiguous()).contiguous()
input_.sum().backward()
Traceback (most recent call last):
  File "blah.py", line 15, in <module>
    input_.sum().backward()
  File "/Users/michaelp/Code/Text-to-Speech/venv/lib/python3.7/site-packages/torch/tensor.py", line 195, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph)
  File "/Users/michaelp/Code/Text-to-Speech/venv/lib/python3.7/site-packages/torch/autograd/__init__.py", line 99, in backward
    allow_unreachable=True)  # allow_unreachable flag
RuntimeError: columns needs to be contiguous

cc @VitalyFedyunin

@cpuhrsch
Copy link
Contributor

cpuhrsch commented Feb 11, 2020

@VitalyFedyunin - could this be related to memory formats? I'm assigning myself to keep track of this.

@cpuhrsch cpuhrsch added the module: cpu CPU specific problem (e.g., perf, algorithm) label Feb 11, 2020
@cpuhrsch cpuhrsch self-assigned this Feb 11, 2020
@cpuhrsch cpuhrsch added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Feb 11, 2020
@VitalyFedyunin
Copy link
Contributor

We havn't touched Conv1d yet, but this is in my area of expertise to debug and fix, I will take over this issue.

@VitalyFedyunin
Copy link
Contributor

Note: Reproducible on nightly (master) as well

@VitalyFedyunin
Copy link
Contributor

Fixed

@Guitaricet
Copy link
Contributor

Guitaricet commented Mar 10, 2020

Is there any workaround until a new pytorch release?
UPD: Nightly build solved my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: cpu CPU specific problem (e.g., perf, algorithm) triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

4 participants