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: Tensors must have same number of dimensions: got 3 and 2 #17

Open
sumorday opened this issue Jun 23, 2021 · 0 comments
Open

Comments

@sumorday
Copy link

hey,I try to use some other method like word2vec, xlnet and ERNIE.
but when I run the last part of code.(pytorch version),it failed.

    # Generate the output of the Discriminator for real and fake data.
    # First, we put together the output of the tranformer and the generator
    **disciminator_input = torch.cat([hidden_states, gen_rep], dim=1)**

RuntimeError: Tensors must have same number of dimensions: got 3 and 2

I checked the shape below
gen_rep.shape ---->torch.Size([64, 768])
hidden_states.shape ---->torch.Size([64, 64, 768])
torch.cat((gen_rep,hidden_states),dim=1)
if I run the bert model it can work, but when I try to use other NLP model like Xlnet and ERNIE. it seems the issue of dimension is existing. How can I do?

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