You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Non-contiguous gradient vectors currently cause segmentation faults as shown by example below!
import taichi as ti
import torch
@ti.kernel
def double_kernel(x:ti.types.ndarray(dtype=ti.f32, ndim=1),
out:ti.types.ndarray(dtype=ti.f32, ndim=1)):
for i in range(x.shape[0]):
out[i] = 2*x[i]
if __name__ == '__main__':
ti.init(log_level=ti.DEBUG, debug=True)
device = torch.device('cpu')
params = torch.rand(1000, dtype=torch.float32, device=device)
out = torch.zeros_like(params)
double_kernel(params, out)
out.requires_grad_(True)
grad = torch.tensor([1.], dtype=torch.float32)
out.grad = grad.expand(1000) # make a non contiguous tensor
double_kernel.grad(params, out)
The text was updated successfully, but these errors were encountered:
Non-contiguous gradient vectors currently cause segmentation faults as shown by example below!
The text was updated successfully, but these errors were encountered: