Pt Interpolate To Size
Resize a tensor to an exact resolution
- tens
- TENSOR
When you need a tensor at exactly 512×512 - not "double it" - this is the node. Pt Interpolate To Size is torch.nn.functional.interpolate with an explicit size=(height, width), which makes it the exact-size sibling of Pt Interpolate By Scale Factor. In practice that's the one you want when you're matching a model's expected input resolution, or lining up feature maps of different shapes before you combine them.
How it works
Same machinery as its scale-factor twin: it takes a (c, h, w) or (b, c, h, w) tensor, pushes rank-3 inputs through a batch of one, interpolates, and squeezes back. The difference is purely in what drives the resize - height and width integers instead of a multiplier.
Inputs worth knowing:
- tens - the tensor to resize, channel-first.
- height / width - the target dimensions, 1 to 16384.
- mode -
nearest-exact,bilinear,bicubic, ornearest.
The mode pick matters in the same way as everywhere else: bicubic for anything you want to look smooth, nearest for labels and masks where you must not invent intermediate values.
The trap: the defaults are zero
Here's the thing that will get you on the first run - height and width default to 0, even though the slider minimum is 1. Forget to set them and you're asking for a 0×0 resize, which blows up. Every time you add this node, set the size before you hit run. It's a one-line fix but it's also the most common way this node goes red.
The channel-order gotcha applies too. ComfyUI images arrive as (b, h, w, c); this pack wants (b, c, h, w). Convert with Pt From Image and permute (0, 2, 3, 1) going in, then Pt Permute (0, 3, 1, 2) and Pt To Image coming back out. And if your tensor isn't float, bilinear/bicubic will complain - cast first.
Installing
Standard story for this pack. It ships inside HowToSD/ComfyUI-Pt-Wrapper under the "Data Analysis" menu - install the pack once, get all ~200 nodes. ComfyUI Manager: search ComfyUI-Pt-Wrapper, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper
The heavy requirements.txt (transformers, datasets, peft, accelerate…) only matters for the training side; plain resizing needs just PyTorch, which ComfyUI already has. Skip the pip line if you're only doing tensor math. No models to download.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| tens | TENSOR | — | |
| height | INT | 01–16384 | — |
| width | INT | 01–16384 | — |
| mode | COMBO | 4 options: nearest-exact, bilinear, bicubic, nearest |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| TENSOR | TENSOR | — |