Segmentation fault passing tensor and using as type const float*

Hi I want to enable gradients for the tan_fovx and tan_fovy variables in this library: GitHub - graphdeco-inria/diff-gaussian-rasterization at 59f5f77e3ddbac3ed9db93ec2cfe99ed6c5d121d
I modified their types in to const torch::Tensor&, which were originally float. And referenced them with tan_fovx.contiguous().data() so they can be used as const float* in other places. In the actual computations I used *tan_fovx to refer to them.
I was able to get the library to build but it segfaulted in run time. What am I doing wrong? Thanks.

Check the stacktrace via gdb and try to narrow down which memory access fails. Maybe the underlying data was already freed when you are trying to access the float*.