Pt Size Create
Build a size object from a typed list — no tensor needed
- PTSIZE
Pt Size Create lets you make a tensor shape out of thin air. Where Pt Size reads a shape from an existing tensor, this one writes one: you type [2, 3, 96, 32] into a text field and out comes a PTSIZE object describing exactly that shape, no tensor involved. It's the constructor for the pack's size objects, and it's useful any time you want to define a shape as a named, reusable value in your workflow - then compare it, convert it, or hand it to nodes that work with sizes.
What it actually does
It's a wrapper around torch.Size(...). The single input, data, is a multiline text field where you type the dimensions as a Python list or tuple - [2, 3, 96, 32] or (2, 3, 96, 32). The node parses it with Python's ast.literal_eval and builds a torch.Size from the result, which comes out as a PTSIZE.
That's it. One input, one output. The "why" is about workflow architecture: instead of hardcoding a shape in five different places, you define it once with Pt Size Create and route that PTSIZE where it's needed. Pair it with Pt Size To String to log it, Pt Size To Numpy to get it as an array for computation, or Pt Show Size to eyeball it. It's also handy for verifying assumptions - create the shape you expect, and check a real tensor's shape against it.
Only one input:
- data - the shape as a list or tuple literal, e.g.
[2, 3, 96, 32].
Output is a single PTSIZE.
How to install it
It's part of the ComfyUI-Pt-Wrapper pack. ComfyUI Manager: search ComfyUI-Pt-Wrapper, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper
Restart after. The pack's requirements.txt is heavy (transformers, datasets, accelerate, peft, gensim, sentencepiece, pandas, scikit-learn, scipy) - slow first install, possible conflicts with other nodes' pinned versions.
Gotchas
Same parsing trap as the rest of the pack's string inputs: data must be valid Python list or tuple syntax. [2, 3, 96, 32] works; 2, 3, 96, 32 without brackets does not, and you'll get a parse error. Negative numbers won't make sense as a size, either - a dimension of -1 has no meaning here like it does in reshape, so keep your values positive integers.
And the type caveat from Pt Size applies in reverse: the PTSIZE you create is a pack-specific type. It won't wire into other packs' generic nodes, so keep its consumption inside this pack's size nodes.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| data | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| PTSIZE | PTSIZE | — |