Nodes/ComfyUI-3D-MeshTool/List to Tensor
ComfyUI Node

List to Tensor

The five-line bridge between Python lists and the pack's tensors

By 807502278·Created 2 years ago·Updated 2 years ago· 23
List to Tensor
  • array
  • Tensor

List to Tensor does exactly one thing: takes a LIST and turns it into the pack's Tensor type via torch.tensor(array). It's the smallest useful node in ComfyUI-3D-MeshTool, and you'll hit it constantly once you start driving the camera and mesh math with data.

Why bother? The pack's array nodes (the array1 family: step, end-increment, select-element, and so on) all output plain LISTs, while the tensor side of the pack - tensor-new, RT-to-camposes, img-bath-rotationZ, the mesh editing nodes - wants Tensor. This node is the on-ramp. It also makes it trivial to hand-craft a list in a Show Text-style node and drop it into tensor math, which is handy for prototyping camera paths without writing JSON.

The one input, the one output

  • array (LIST) - any nested or flat Python list of numbers.
  • Tensor - the same data, as a torch.Tensor.

There's no shape validation. Give it a ragged nested list and it'll throw a conversion error; give it a clean 2D grid (like a 6 x N x 3 set of camera rows) and you get exactly the tensor those nodes expect. The reverse direction is the pack's Tensor to List node, so the pair works as a round-trip for editing intermediate data.

Install

It's part of the ComfyUI-3D-MeshTool pack, so installing the pack gets you this node:

cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-3D-MeshTool
cd ComfyUI-3D-MeshTool
pip install -r requirements.txt

Restart ComfyUI after. Or use ComfyUI Manager and search "ComfyUI-3D-MeshTool".

Notes

Mind your dtypes: converting integers gives an int64 tensor, and some downstream math wants floats. If you're building camera data, make sure your source lists contain floats (add .0 or convert upstream), or the arithmetic further down may surprise you. And remember this is a conversion node, not a math node - the pack's tensor-new and the array1 tools are the ones that generate and manipulate data; this one just changes its skin.

Category3D_MeshTool/Convert

Inputs (1)

NameTypeDefaultDescription
arrayLIST

Outputs (1)

NameTypeDescription
TensorTensor