ztcl::tensor full
Makes a tensor with one value in each element.
ztcl::tensor full SHAPE VALUE ?DTYPE?
Description
Makes a tensor of SHAPE with VALUE in each element. The default dtype is f32. For i32, VALUE goes toward zero to an integer, and a value out of the range of i32 becomes its nearest end.
Returns
A tensor.
Examples
Each example of this page runs after package require ztcl::tensor.
% ztcl::tensor full {2 2} 7
tensor f32 {2 2} {7.0 7.0 7.0 7.0}
% ztcl::tensor full 3 2.9 i32
tensor i32 3 {2 2 2}
Errors
% ztcl::tensor full {2 2} x
tensor: expected a number but got "x"
-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.