Giter VIP home page Giter VIP logo

lunatic-python's People

Contributors

adnanyaqoobvirk avatar alband avatar bastibe avatar blgene avatar chrisju avatar greatwolf avatar gward avatar mp-pbn avatar sapir avatar skorokithakis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

lunatic-python's Issues

Remove fblualib dependancy

The goal here would be to remove the fblualib dependancy that is very heavy and complex to install. For that we could use direclly use the TH C API (and move back the lunatic python code to pure C code)

For the fblualib dependency, all the corresponding source and headers are in the fblualib-* folders. What we use from this source is:

  • PyObjectHandle from Utils.h. This is just a wrapper over PyObjects this can be removed with some extra Py_INCREF calls.
  • LuaToPythonConverter class from LuaToPython.h. In practice, the only thing used in this class is the convertTensor function used to create a numpy array from a Torch tensor.
  • NumpyArrayAllocator and the corresponding thpp calls made in the pushTensor function in pythoninlua.cpp. This is the function creating a Torch tensor from a numpy array.

Multiple conversions from tensor to np.array

There appears to be an error triggered when passing the same tensor through to python.

For instance, this bit of code

lp = require('lpython')
pd = lp.import('pandas')

b = torch.Tensor({{1,2,3},{4.1,5,6}})
c = torch.cdiv(b, b:sum(2):expandAs(b)):mul(100)

df = pd.DataFrame(c)
df2 = pd.DataFrame(c)

creates the error

Trying to create an array from an unresizable tensor. Abording.
[string "dfcm = pd.DataFrame(c)"]:1: failed to convert argument #1
stack traceback:
	[C]: in function 'DataFrame'
	[string "dfcm = pd.DataFrame(c)"]:1: in main chunk
	[C]: in function 'xpcall'
	/home/nsid/torch/share/lua/5.1/trepl/init.lua:679: in function 'repl'
	/home/nsid/torch/lib/luarocks/rocks/trepl/scm-1/bin/th:204: in main chunk
	[C]: at 0x00405de0	

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.