Skip to content

Instantly share code, notes, and snippets.

{
"aot_data": {
"kernels": {
"0": {
"program": {
"kernels": {
"0": {
"kernel_name" : "init_c40_00",
"kernel_src" : ".//taichi_example.tcb_init_c40_00.glsl",
// Test Code
import taichi as ti
ti.init(arch=ti.vulkan,log_level=ti.TRACE)
def test_snode_read_write():
dtype = ti.f16
x = ti.field(dtype, shape=())
x[None] = 0.3
print(x[None])
import taichi as ti
from types import ModuleType, FunctionType
import inspect
import pdb
import csv
# FIXME: Without this init some calls will fail
ti.init()
def has_doc_string(x):
import os, json
import taichi as ti
ti.init(arch=ti.opengl, allow_nv_shader_extension=False, use_gles=True, ndarray_use_torch=False)
dim = 2
N = 64
n_particles = N * N * 2
n_grid = 128
p_rho = 1
bound = 3
E = 400
import paddle
Python 3.8.11 (default, Aug 3 2021, 15:09:35)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.26.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import paddle
In [2]: import numpy as np
In [4]: x = paddle.to_tensor(2 * np.ones((4, ), dtype=np.flo
...: at32))
import taichi as ti
ti.init()
# you must make sure the func body here works both in python and taichi scope.
def f():
a = 0
for i in range(10):
a += i
print(a)
import taichi as ti
ti.init(ti.vulkan)
tp_ivec3 = ti.types.vector(3, ti.i32)
tp_ivec2 = ti.types.vector(2, ti.i32)
tp_vec3 = ti.types.vector(3, ti.f32)
x = ti.ndarray(ti.f32, shape=(12, 13))
y = ti.ndarray(tp_ivec3, shape=(12,4))