Good catch @b02202050!
final_kernel will break the computation graph, as you are using numpy functions, which cannot be tracked by Autograd, and you are also detaching pc_first via pc_first.item(), which creates a Python literal.
Try to replace the numpy methods with their PyTorch equivalents and don’t call .item() on your tensors.