huggingface / huggingface/candle

What is the equivalent of interpolate from torch.nn

Open
#2,349 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
21k
Forks
1.8k
Avg merge
16h 42m
Merged PRs (30d)
25

Description

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();`

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue does not identify a file, test, or entry point; begin by locating Candle's interpolation methods and tensor indexing and dimension APIs. Before changing anything, establish whether the expected outcome is documentation, an API addition, or usage guidance, then define completion around an agreed equivalent for the Torch operations described.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch, rust
Domain
machine-learning
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.