beetlebug▾
/

ztcl::tensor fromrows

Joins a list of rows into one tensor.

ztcl::tensor fromrows DTYPE TAIL ROWS

Description

Gives the tensor of DTYPE with the shape of the count of ROWS and then TAIL. Each row is a tensor of the shape TAIL, or its little-endian bytes.

Returns

A tensor.

Examples

Each example of this page runs after package require ztcl::tensor.

% set a [ztcl::tensor of {{1 2 3} {4 5 6}}]; ztcl::tensor fromrows f32 3 [ztcl::tensor rowbytes $a]
tensor f32 {2 3} {1.0 2.0 3.0 4.0 5.0 6.0}

Errors

% ztcl::tensor fromrows f32 3 {abc}
tensor fromrows: row 0 has 3 bytes, and a row needs 12
-errorcode ZTCL TENSOR

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.4
Compute cost
A cost for each element operation by its kind (a copy, an add, a division, a math function, a multiply-add of a matmul), set so that one compute unit takes about the time of one unit of plain Tcl. docs/modules/tensor.md has the table.