How to go into the codes behind the '_backend'

Hi, all. I am new for pytorch. I wonder how to read the deeper code behind the ‘_backend’ in the module. The example codes are in the file “torch/nn/modules/”, around line 96:
def forward(self, input):
padding_idx = self.padding_idx
if padding_idx is None:
padding_idx = -1
return self._backend.Embedding.apply(
input, self.weight,
padding_idx, self.max_norm, self.norm_type,
self.scale_grad_by_freq, self.sparse
Here, I wonder how to read the code behind “self._backend.Embedding.apply”? The “_backend” is actually ‘’ thnn", and where can I find the corresponding codes to the ‘Embedding.apply’ Thanks for help.


Got the same issue, with v0.4 I got a raise NotImplementedError for a line that called Embedding._backend.Embedding.apply(). How should I interpret this?

I think you can use torch.nn.functional and use F.embedding in v0.4

1 Like

I’ve gotten the same trouble as you did, did you solve your problem? It raise an erroe that _backend is not implemented, and I don’t know how to implement nn.mbedding to pass to inputs.