ztcl::tensor scalar
Makes a tensor of rank 0.
ztcl::tensor scalar VALUE ?DTYPE?
Description
Makes a tensor with the shape {} and the one element VALUE. The default dtype is f32.
Returns
A tensor.
Examples
Each example of this page runs after package require ztcl::tensor.
% ztcl::tensor scalar 0.1
tensor f32 {} 0.1
% ztcl::tensor scalar -3 i32
tensor i32 {} -3
Errors
% ztcl::tensor scalar 1.5 i32
tensor: expected an integer but got "1.5"
-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.