New upgrade broke from_numpy?

Hi,
I just upgraded to 0.6.27 and some of the old code now broke?

code:

import numpy as np
import taichi as ti
ti.init(arch=ti.cuda)   # use gpu

pixels = ti.field(ti.f32, (1024, 512))

arr = np.random.rand(1024, 512)
pixels.from_numpy(arr)   # load numpy data into taichi fields

and the error:
``
[Taichi] mode=release
[Taichi] preparing sandbox at /tmp/taichi-6tbgid05
[Taichi] version 0.6.27, llvm 10.0.0, commit a34a6128, linux, python 3.7.8
[I 08/16/20 14:59:11.218] [shell.py:_shell_pop_print@29] Graphical python shell detected, using wrapped sys.stdout
[Taichi] Starting on arch=cuda
[Taichi] materializing…
Traceback (most recent call last):

File “/home/ling/proj-taichi/test/ti.bug4.py”, line 16, in
pixels.from_numpy(arr) # load numpy data into taichi fields

File “/home/ling/.local/lib/python3.7/site-packages/taichi/lang/util.py”, line 212, in wrapped
return func(*args, **kwargs)

File “/home/ling/.local/lib/python3.7/site-packages/taichi/lang/expr.py”, line 192, in from_numpy
ext_arr_to_tensor(arr, self)

File “/home/ling/.local/lib/python3.7/site-packages/taichi/lang/kernel.py”, line 578, in wrapped
return primal(*args, **kwargs)

File “/home/ling/.local/lib/python3.7/site-packages/taichi/lang/shell.py”, line 34, in new_call
ret = old_call(*args, **kwargs)

File “/home/ling/.local/lib/python3.7/site-packages/taichi/lang/kernel.py”, line 505, in call
self.materialize(key=key, args=args, arg_features=arg_features)

File “/home/ling/.local/lib/python3.7/site-packages/taichi/lang/kernel.py”, line 358, in materialize
filename=oinspect.getsourcefile(self.func),

File “/home/ling/.local/lib/python3.7/site-packages/sourceinspect/init.py”, line 81, in getsourcefile
return get_inspector().getsourcefile(object)

File “/home/ling/.local/lib/python3.7/site-packages/sourceinspect/init.py”, line 40, in getsourcefile
return ins.file

File “/home/ling/.local/lib/python3.7/site-packages/sourceinspect/init.py”, line 28, in file
ret = self._file()

File “/home/ling/.local/lib/python3.7/site-packages/sourceinspect/ipython.py”, line 15, in _file
lineno = self.getlineno()

AttributeError: ‘IPythonInspector’ object has no attribute ‘getlineno’

Can someone help?
Thanks

Sorry about the confusion here, it’s probably a bug in sourceinspect. Try this command:

pip uninstall sourceinspect

And taichi should be functional again with just a warning.

1 个赞