How to use the taichi.root.place function in taichi

To help you get started, we’ve selected a few taichi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yuanming-hu / taichi / tests / python / test_sparse_parallel.py View on Github external
def place():
    ti.root.dense(ti.i, n).pointer().dense(ti.i, n).place(x)
    ti.root.place(s)
github yuanming-hu / taichi / tests / python / test_stop_grad.py View on Github external
def place():
    ti.root.dense(ti.i, n).place(x)
    ti.root.place(loss)
    ti.root.lazy_grad()
github yuanming-hu / taichi / tests / python / test_complex_kernels.py View on Github external
def place(self, root):
      ti.root.dense(ti.i, self.n).place(self.x)
      ti.root.place(self.total)
github yuanming-hu / taichi / tests / python / test_oop.py View on Github external
def place():
    ti.root.place(
        arr)  # Place an object. Make sure you defined place for that obj
    ti.root.place(double_total)
    ti.root.lazy_grad()
github yuanming-hu / taichi / examples / minimization_trivial.py View on Github external
def data():
  ti.root.dense(ti.i, n).place(x, y, x.grad, y.grad)  # place gradient tensors
  ti.root.place(L, L.grad)
github yuanming-hu / taichi / examples / difftaichi / mass_spring.py View on Github external
def place():
  ti.root.dense(ti.l, max_steps).dense(ti.i, n_objects).place(x, v, v_inc)
  ti.root.dense(ti.i, n_springs).place(spring_anchor_a, spring_anchor_b,
                                       spring_length, spring_stiffness,
                                       spring_actuation)
  ti.root.dense(ti.ij, (n_hidden, n_input_states())).place(weights1)
  ti.root.dense(ti.i, n_hidden).place(bias1)
  ti.root.dense(ti.ij, (n_springs, n_hidden)).place(weights2)
  ti.root.dense(ti.i, n_springs).place(bias2)
  ti.root.dense(ti.ij, (max_steps, n_hidden)).place(hidden)
  ti.root.dense(ti.ij, (max_steps, n_springs)).place(act)
  ti.root.dense(ti.i, max_steps).place(center)
  ti.root.place(loss, goal)
  ti.root.lazy_grad()
github yuanming-hu / taichi / examples / difftaichi / mass_spring_velocity.py View on Github external
def place():
  ti.root.dense(ti.l, max_steps).dense(ti.i, n_objects).place(x, v, v_inc)
  ti.root.dense(ti.i, n_springs).place(spring_anchor_a, spring_anchor_b,
                                       spring_length, spring_stiffness,
                                       spring_actuation)
  ti.root.dense(ti.ij, (n_hidden, n_input_states())).place(weights1)
  ti.root.dense(ti.i, n_hidden).place(bias1)
  ti.root.dense(ti.ij, (n_springs, n_hidden)).place(weights2)
  ti.root.dense(ti.i, n_springs).place(bias2)
  ti.root.dense(ti.ij, (max_steps, n_hidden)).place(hidden)
  ti.root.dense(ti.ij, (max_steps, n_springs)).place(act)
  ti.root.dense(ti.i, max_steps).place(center, target_v)
  ti.root.place(loss, goal)
  ti.root.lazy_grad()
github yuanming-hu / taichi / examples / global_as_parameter.py View on Github external
def tensors():
  ti.root.dense(ti.i, 16).place(x, y, z)
  ti.root.place(loss)
  ti.root.lazy_grad()
github yuanming-hu / taichi / examples / difftaichi / diffmpm3d.py View on Github external
def place():
  ti.root.dense(ti.ij, (n_actuators, n_sin_waves)).place(weights)
  ti.root.dense(ti.i, n_actuators).place(bias)

  ti.root.dense(ti.ij, (max_steps, n_actuators)).place(actuation)
  ti.root.dense(ti.i, n_particles).place(actuator_id, particle_type)
  ti.root.dense(ti.l, max_steps).dense(ti.k, n_particles).place(x, v, C, F)
  ti.root.dense(ti.ijk, n_grid).place(grid_v_in, grid_m_in, grid_v_out)
  ti.root.place(loss, x_avg)
  ti.root.dense(ti.ij,
                (visualize_resolution, visualize_resolution)).place(screen)

  ti.root.lazy_grad()
github yuanming-hu / taichi / examples / difftaichi / wave.py View on Github external
def place():
  ti.root.dense(ti.l, max_steps).dense(ti.ij, n_grid).place(p)
  ti.root.dense(ti.l, max_steps).dense(ti.ij, n_grid).place(p.grad)
  ti.root.dense(ti.ij, n_grid).place(target)
  ti.root.dense(ti.ij, n_grid).place(target.grad)
  ti.root.dense(ti.ij, n_grid).place(initial)
  ti.root.dense(ti.ij, n_grid).place(initial.grad)
  ti.root.place(loss)
  ti.root.place(loss.grad)