Is it possible to use third party torch7 packages in pytorch?

Hi guys, I just have a quick question. Is it possible to use third party torch packages in pytorch. For instance, is it possible to use manifold package from If so how can we achieve that? Is it possible to install it through luarocks install manifold and then in pytorch import torch; import torch.manifold? Is that feasible, if not is there an equivalent method?

No, we don’t support loading Lua modules in Python

@apaszke thanks for the response. So there is no other way to use all those third party packages developed for torch ecosystem? Is pytorch going to support only the basic/main torch packages?

No there’s not, but I’m pretty sure you can find something in a (much richer) Python ecosystem. You can easily convert between tensors and numpy arrays.

ah, I just remembered lutorpy maybe that can do the trick?

I’m afraid that won’t work. PyTorch uses a slightly different version of C backends (0 vs 1-based indexing), and when you load Lua packages with lutorpy, it will resolve the Lua backend symbols to 0-based ones, likely leading to errors in weird places.

Ah, I see. Thanks for mentioning that. If you don’t mind, I have just one last question. Did you guys integrated the third party rnn package into nn for pytorch or is this a re-write?

No, PyTorch packages have been redesigned and rewritten from scratch.

@apaszke thank you for the responses and the clarifications!

1 Like

I believe the functions you’re looking for are implemented in scipy and/or scikit-learn, and you can use them by calling .numpy and .from_numpy on Torch tensors.

Yep, it’s true for the case of manifold learning but sklearn (I don’t wanna be to harsh on it) has very bad implementation that raises errors in some particular cases and doesn’t use the optimal approach. For instance check the issues I raised on github for more in regards to tsne implementation & LLE.

But in the case of rnn package I guess you’ll have to roll your own.