Convert pytorch tensor to mi.Vector3f #1507
-
Hello, I'm trying to write my integrator using mitsuba and I want to spawn new rays based on some calculations that were done using pytorch. So I have: What is the right way to convert this tensor to Vector3f? |
Beta Was this translation helpful? Give feedback.
Answered by
njroussel
Feb 28, 2025
Replies: 1 comment 3 replies
-
Hi @Hochheilige The dimensions need to to be re-ordered prior to conversion, like this: import torch
import mitsuba as mi
mi.set_variant('cuda_ad_rgb')
torch_dirs = torch.arange(30).view(10, 3).cuda() # [10, 3]
mitsuba_dirs = mi.Vector3f(torch_dirs.permute(1, 0)) # re-order before cast |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's surprising, I just tried that small script I had sent on different operating systems and it worked fine.
Here's the versions I'm using:
Do you also have these ?