candle
candle copied to clipboard
What is the equivalent of interpolate from torch.nn
Hi, I need some help with translating things written in Python:
f.e. I have such a statement:
import torch.nn.functional as F
result[mask] = result[mask] + F.interpolate(cur_result.permute(3,0,1,2).unsqueeze(0).contiguous(), (H, W, D), mode='trilinear', align_corners=False).squeeze(0).permute(1,2,3,0).contiguous()[mask]
What is the interpolate equivalent. I've seen that Tensor have methods like intepolate1d and interpolate2d, but they have only dimension sizes of tensor to pass. Also, It would be great to know how to reassign indices, and how to know what's dim, because in torch, there is no dim argument in most of the functions.
Btw. Didn't ask that previously, but is this(Python/torch):
D = indices.shape[-1]
equivalent to(Rust/candle):
let d = indices.dim(D::Minus1).unwrap();