Skip to content

Multiple conversions from tensor to np.array #5

@iffsid

Description

@iffsid

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	

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions