在0.8版本的时候用了taichi_glsl库函数,即import taichi_glsl as tg,没啥问题。今天更新了[Taichi] version 1.0.1,发现调用import taichi_glsl as tg报错了,报错如下:
[Taichi] version 1.0.1, llvm 10.0.0, commit 1c3619d9, win, python 3.9.7
[TaiGLSL] version 0.0.11
Traceback (most recent call last):
File "D:\Taichi\B\20211227.py", line 11, in <module>
import taichi_glsl as tg
File "D:\Miniconda\envs\Taichi\lib\site-packages\taichi_glsl\__init__.py", line 10, in <module>
from .hack import *
File "D:\Miniconda\envs\Taichi\lib\site-packages\taichi_glsl\hack.py", line 24, in <module>
_old_element_wise_binary = ti.Matrix.element_wise_binary
AttributeError: type object 'Matrix' has no attribute 'element_wise_binary'
@ti.func
def isnan(x):
'''
Determine whether the parameter is a number.
For each element element i of the result, `isnan` returns True
if x[i] is posititve or negative floating point NaN (Not a Number)
and False otherwise.
:parameter x:
Specifies the value to test for NaN.
:return:
The return value is computed as `not (x >= 0 or x <= 0)`.
'''
return not (x >= 0 or x <= 0)