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

how to set inputs to the right shape #218

Open
emadkavousi opened this issue Dec 17, 2023 · 1 comment
Open

how to set inputs to the right shape #218

emadkavousi opened this issue Dec 17, 2023 · 1 comment

Comments

@emadkavousi
Copy link

Hi and thanks for this great work . I am new with deep learning and i want to use x_transformer in my project but i cant set my inputs in to the right shape.in all examples in github page input shape is like :
src = torch.randint(0, 256, (1, 1024))
but when I want to reshape my tensors with reshape or view function of pytorch i get an error for example I want to have input with shape
new_shape = (0, 256, (128, 34))
x = x.view(*new_shape)
but i get this error:
x = x.view(*new_shape)
TypeError: view(): argument 'size' must be tuple of SymInts, but found element of type tuple at pos 3
and no matter how I try and search I cant have this shape for input . is there any easy way to give x-transformer inputs with right shape?
am I worng about input shape ?
can you explain to me what is these numbers in src = torch.randint(0, 256, (1, 1024)) in input shape ?
please help me .

@RyanKim17920
Copy link

RyanKim17920 commented Jan 23, 2024

The code "src = torch.randint(0, 256, (1, 1024))" creates a torch shape of (1, 1024) with randomized integers from 0 to 255. Trying to do a view causes an error as you are supposed to input a non-proper shape for a vector, causing the related issues.

You can test this by using print(src.shape) which would give you (1,1024).

Please refer to the website for further details: https://pytorch.org/docs/stable/generated/torch.randint.html

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

2 participants