ComfyUI Node

tensor shape

'tensor shape' builds a shape, it doesn't read one

By 807502278·Created 2 years ago·Updated 2 years ago· 23
tensor shape
    • tensor_shape
    Dim11
    Dim2512
    Dim3512
    Dim43
    Dim50

    tensor shape is one of those nodes whose name sounds obvious and is exactly backwards. It does not look at an existing tensor and tell you its shape - that's its sibling get tensor shape from the same pack. This one constructs a shape tuple out of the five integer inputs you type in, so you can hand it to a node that wants a TUPLE of dimensions. Think of it as a "specify a tensor's dimensions" node rather than an inspector.

    You'll reach for it inside 3D and batch workflows when some node needs to know how big a tensor should be before it exists. The defaults tell the whole story: Dim1=1, Dim2=512, Dim3=512, Dim4=3, Dim5=0. Zero means "stop here", so the defaults assemble into (1, 512, 512, 3) - a single 512×512 RGB image, i.e. exactly the layout ComfyUI's image tensors use. Want a 2D matrix of 64 floats? Set Dim1=64, Dim2=64, and everything after to 0. The rule is simple: the first Dim you set to zero is where the tuple ends.

    In this pack the shape you build feeds tensor new, which fills a tensor of that shape with either a constant value or random noise. That's the actual pipeline this node belongs to: shape → tensor → image. If you're coming from pure 2D ComfyUI, this is the moment you've crossed into a graph that talks in raw torch tensors instead of prepackaged IMAGE objects.

    Inputs worth your attention, honestly, are just the five Dim1Dim5 integers - and only the ones you care about, since trailing zeros get trimmed. There's exactly one output, tensor_shape (a TUPLE), and it wires into anything that accepts a shape tuple.

    One thing to know before you rely on it: this whole pack is a one-developer utility collection, and it leans on the Tensor/TUPLE types and the general conventions of ComfyUI-3D-Pack, so if a workflow built around these tensor nodes won't load, check whether that 3D pack is installed first. The author also renames nodes between releases, and old ones go red - recreate the node rather than hunting for a missing one.

    Install it the usual way: ComfyUI Manager → search "ComfyUI-3D-MeshTool" → install, then restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/807502278/ComfyUI-3D-MeshTool
    cd ComfyUI-3D-MeshTool
    pip install -r requirements.txt   # kiui, xatlas, pyfqmr, plyfile
    

    Nothing here needs a model download - the tensor nodes are pure math on numbers you type. If you mainly work with regular images, this node is marginal; if you're feeding a mesh or multi-view render pipeline that wants precise tensor dimensions, it's the cleanest way to spell them out.

    Category3D_MeshTool/Array/Tensor

    Inputs (5)

    NameTypeDefaultDescription
    Dim1INT11–999999
    Dim2INT5120–999999
    Dim3INT5120–999999
    Dim4INT30–999999
    Dim5INT00–999999

    Outputs (1)

    NameTypeDescription
    tensor_shapeTUPLE