beetlebug▾
/

ztcl::tensor zeros

Makes a tensor of zeros.

ztcl::tensor zeros SHAPE ?DTYPE?

Description

Makes a tensor of SHAPE with 0 in each element. The default dtype is f32.

Returns

A tensor.

Examples

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

% ztcl::tensor zeros {2 3} i32
tensor i32 {2 3} {0 0 0 0 0 0}

Errors

% ztcl::tensor zeros {-1}
tensor: bad shape "-1"
-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.