跳转至主要内容

taichi.aot.record#

taichi.aot.record.start_recording(filename)#

Starts recording kernel information to a yml file.

Parameters:

filename (str) – output yml file.

Example:

>>> ti.aot.start_recording('record.yml')
>>> ti.init(arch=ti.cc)
>>> loss = ti.field(float, (), needs_grad=True)
>>> x = ti.field(float, 233, needs_grad=True)
>>>
>>> @ti.kernel
>>> def compute_loss():
>>> for i in x:
>>> loss[None] += x[i]**2
>>>
>>> @ti.kernel
>>> def do_some_works():
>>> for i in x:
>>> x[i] -= x.grad[i]
>>>
>>> with ti.ad.Tape(loss):
>>> compute_loss()
>>> do_some_works()
taichi.aot.record.stop_recording()#

Stops recording kernel information.

This function should be called in pair with start_recording().