Nodes/ComfyUI-Pt-Wrapper/Pt Float Create
ComfyUI Node

Pt Float Create

Type numbers, get a float32 tensor

By HowToSD·Created about a year ago·Updated about a year ago· 7
Pt Float Create
    • TENSOR
    data

    Pt Float Create is the node for when you just want a tensor of specific numbers without loading anything. You type a Python list into a text box, it becomes a float32 PyTorch tensor, done. It's the smallest node in the pack's "create a tensor" family and honestly the most useful one for poking at things: quick sanity checks, hand-built feature vectors, coefficients for a math experiment you want to run through the tensor ops.

    How it works

    The mechanism is delightfully transparent: the multiline data field is parsed with Python's ast.literal_eval, then handed to torch.tensor(..., dtype=torch.float32). So whatever literal you type is interpreted as a Python structure and cast to floats.

    What this means in practice:

    • 1.5 → a zero-dimensional (scalar) tensor
    • [1.0, 2.0, 3.0] → a 1-D tensor of three floats
    • [[1.0, 2.0], [3.0, 4.0]] → a 2×2 tensor

    Because it's ast.literal_eval and not eval, it only accepts literals - numbers, lists, tuples - which is actually a safety feature. It won't run arbitrary expressions, and it also means expressions like 1/3 or [i for i in range(3)] will error. Type the literal values, not the code.

    What to know about the output

    The output TENSOR plugs into the whole Pt-Wrapper math graph: Pt Add, Pt MatMul, Pt Mean, the activation callables, or as the x side of Pt Data Loader From Tensors when you're fabricating a tiny dataset. Everything downstream expects float32 anyway, so the dtype choice here saves you from dtype-mismatch errors later.

    The node lives in the pack's "Tensor creation" family, alongside Pt Int Create (same idea, integer dtype) and Pt Arange / Pt Linspace for generated ranges - if you need a sequence of evenly spaced values, reach for those instead of typing a thousand numbers.

    Where people get burned

    • Trailing commas or single quotes for tuples: (1, 2,) parses fine, but typos like [1, 2, (unclosed) raise a parse error. The error message will say something about "malformed node or string" - that's the literal-eval complaining, not your machine breaking.
    • Mixing types: [1, "two"] fails, because a string isn't a valid literal element for this use.
    • Expecting integers: everything becomes float32. If you genuinely need ints (say, for indices), use Pt Int Create instead.

    Installing it

    This is a ComfyUI-Pt-Wrapper node, so you install the pack once:

    • ComfyUI Manager → Install Custom Nodes → search "ComfyUI-Pt-Wrapper" → Install → restart.
    • Or cd ComfyUI/custom_nodes && git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper and restart.

    Be ready for a slow first startup - the pack's requirements.txt drags in transformers, datasets, peft, accelerate, scikit-learn, scipy, gensim and sentencepiece even if you only ever touch the tensor math. No model downloads needed for this node. It's an obscure, education-focused pack by a solo author (HowToSD), so community help is thin; the repo's docs/reference/ is your best friend.

    CategoryData Analysis

    Inputs (1)

    NameTypeDefaultDescription
    dataSTRING

    Outputs (1)

    NameTypeDescription
    TENSORTENSOR