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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: "param" dim[1] must be greater or equal than dim[2] #9

Open
chakrabortym242 opened this issue Dec 28, 2024 · 0 comments

Comments

@chakrabortym242
Copy link

My code is:

import torch
from torch_householder import torch_householder_orgqr

Generate random values

random_tensor = random_tensor = torch.randn(64, 4, 16, 60)

def Household(tensor):
batch_size, num_heads, dim1, dim2 = tensor.shape
reshaped_tensor = tensor.reshape(-1, dim1, dim2) # Shape: [batch * num_heads, dim, dim]
hh= reshaped_tensor.tril(diagonal=-1) + torch.eye(dim1,dim2, device=reshaped_tensor.device)
orthogonal_matrix = torch_householder_orgqr(hh)
# Reshape back to the original shape [batch_size, num_heads, dim, dim]
orthogonal_matrix = orthogonal_matrix.view(batch_size, num_heads, dim1, dim2)
return orthogonal_matrix

It shows error while calculating torch_householder_orgqr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant