运行如下程序
@ti.kernel
def initialize(self,):
for I in ti.grouped(self.phi):
for p in range(self.phi[I].n):
self.phi[I][p] = 1. / self.phase_nums
### set some initial perturbation for phi
for p in range(self.phi[I].n):
self.phi[I][p] = self.phi[I][p] \
- self.fluctuation + 2.*self.fluctuation * ti.random(ti.f64)
### normalization
self.phi[I] /= self.phi[I].sum()
for I in ti.grouped(self.phi):
self.phi_old[I] = self.phi[I]
报错内容`D:\Document\debug> & D:/Python/python.exe d:/Document/debug/polycrystal_grain_growth.py
[Taichi] version 1.7.2, llvm 15.0.1, commit 0131dce9, win, python 3.12.7
[Taichi] Starting on arch=cuda
[E 11/27/24 16:04:35.286 5452] [type_factory.cpp:taichi::lang::promoted_type@276] a = f64, b = [Tensor (16) f64], only one of them is a tensor type
Traceback (most recent call last):
File “d:\Document\debug\polycrystal_grain_growth.py”, line 180, in
polycrys.initialize()
^^^^^^^^^^^^^^^^^^^^^
File “D:\Python\Lib\site-packages\taichi\lang\kernel_impl.py”, line 1174, in call
return self._primal(self._kernel_owner, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\Python\Lib\site-packages\taichi\lang\kernel_impl.py”, line 1045, in call
return self.launch_kernel(kernel_cpp, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\Python\Lib\site-packages\taichi\lang\kernel_impl.py”, line 976, in launch_kernel
raise e from None
File “D:\Python\Lib\site-packages\taichi\lang\kernel_impl.py”, line 969, in launch_kernel
compiled_kernel_data = prog.compile_kernel(prog.config(), prog.get_device_caps(), t_kernel)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: [type_factory.cpp:taichi::lang::promoted_type@276] a = f64, b = [Tensor (16) f64], only one of them is a tensor type`