General question for experienced coders

I was trying to find out how to turn the data in an Embedding variable to a tensor.
I searched google but couldn’t find anything, I looked at the documentation but still nothing.

I solved this by going over all the options in the auto-complete and testing some methods that seemed to be relevant (finally getting to .data).
This seems to be the wrong way of searching for the solution.

Of course I could post on a forum like this but that would mean that I’ll be stuck until someone replies.

I’d love to hear tips on how to handle such cases?

Well nn.Embedding is not itself a tensor, is it? It’s a module, like nn.Linear for example. nn.Linear cannot be converted to a Tensor, similarly Embedding can’t either. They can have some sort of tensors associated with them. nn.Linear has weights and biases associated, and the docs for nn.Embedding mention the existence of the tensor Embedding.weight. So isn’t that what you want? It seems to be there in the docs…

1 Like

Yes, you are correct.
I see now that I had a mixup in my code. I’ll delete this thread to avoid confusion.

Thank you!

1 Like

No worries! You don’t need to delete the thread because maybe it’s useful to others who are searching for a similar question :wink: