From Values

Shipping
array_from_values

Parse a pasted list of numbers into an array; optional shape folds it into a grid

Signature

Outputs

  • arrayArrayThe parsed literal as an array. Blank shape → a flat 1-D Vector; a given shape folds the values into that grid (element count must match exactly).

Parameters

KeyTypeDefaultNotes
valuestextThe numbers, separated by commas, spaces, semicolons or newlines (e.g. '1, 2, 3, 4'). Paste a row or CSV fragment directly.
shapetextOptional shape to fold the values into (numpy-style, e.g. '2, 2'). Blank ⟹ a flat 1-D Vector. The element count must match exactly.
unittextOptional physical unit, applied only to a 1-D (Vector) result.

Description

From Values turns a hand-typed or pasted list of numbers into an array — the array-literal counterpart of the Constant node's scalar. The Values field is very forgiving: commas, spaces, semicolons and newlines are all treated as separators, so you can paste a CSV row, a whitespace column, or 1, 2; 3 4 directly. A non-numeric token is a hard error (never silently dropped).

Leave Shape blank to get a flat 1-D Vector of the parsed length; give a numpy-style shape (e.g. 2, 2) to fold the same values into that grid. The element count must match the shape exactly — a mismatch errors rather than cropping or padding. The rank of the given shape picks Vector / Matrix / Tensor, and Unit attaches only to a 1-D result.

Mathematics

Examples

A flat vector

Values = 1, 2, 3, 4, Shape blank → the Vector .

Folding into a matrix

Values = 1, 2, 3, 4, Shape = 2, 2 → the Matrix (row-major). Values = 1, 2, 3 with Shape = 2, 2 is an error — 3 ≠ 4 elements.

Applications

  • Injecting a small known constant vector or matrix (filter taps, a lookup table, calibration coefficients) into a graph.
  • Pasting a CSV row or column of measurements as an array without a file import.
  • Quickly authoring test fixtures / expected outputs inline on the canvas.

Neat

The parser accepts commas, semicolons and any whitespace interchangeably, so a pasted CSV fragment, a space-delimited row, or a multi-line column all parse to the same flat buffer before the optional reshape.

Reshape is strict: the element count is validated against the shape and a mismatch errors — the literal is never cropped or zero-padded to fit.

Known issues

Any non-numeric token in Values is a hard error, not a skipped entry.

A given Shape whose product differs from the element count errors instead of truncating/padding.

The unit is applied only to a rank-1 (Vector) result.

See also

arrayvectormatrixsourceliteralparseconstructorstateless