Private
Compute the mathematical ceiling (round up) of each element in a tensor. There is a static function version of this method: ceil.
$$\lceil x \rceil : \forall x \in T$$
const t = sm.randn([128, 128])
// equivalent calls
const a = t.ceil()
const b = sm.ceil(t)
Optional
sx: numberOptional
sy: numberOptional
px: numberOptional
py: numberOptional
dx: numberOptional
dy: numberOptional
groups: numberCalculate the error function (Wikipedia entry) for each element in a Tensor. There is a static function version of this method: erf.
$$\frac{2}{\sqrt{\pi}}\int_0^{x} e^{-t^2} dt : \forall x \in T$$
const t = sm.randn([1337])
// equivalent calls
const a = t.erf()
const b = sm.erf(t)
Compute the mathematical floor (round down) of each element in a tensor. There is a static function version of this method: floor.
$$\lfloor x \rfloor : \forall x \in T$$
const t = sm.randn([128, 128])
// equivalent calls
const a = t.floor()
const b = sm.floor(t)
Compute the natural logarithm of one plus each element in a tensor. There is a static function version of this method: log1p.
$$\ln(1 + x) : \forall x \in T$$
const t = sm.randn([100])
// equivalent calls
const a = t.log1p()
const b = sm.log1p(t)
Take the logical not
of every element in a tensor. There is a static function version of this method: logicalNot.
$$\neg x : \forall x \in T$$
const t = sm.rand([100]).greaterThan(sm.scalar(0.5))
// equivalent calls
const a = t.logicalNot()
const b = sm.logicalNot(t)
Determine the indices of elements that are non-zero. There is a static function version of this method: nonzero.
Indices correspond to a flattened version of the input tensor.
const t = sm.randn([100])
// equivalent calls
const a = t.nonzero()
const b = sm.nonzero(t)
Reshape a Tensor without modifying the underlying data. There is a static function version of this method: reshape.
The resultant shape must contain the same number of elements as the base Tensor.
const t = sm.randn([64])
// equivalent calls
const a = t.reshape([8, 8])
const b = sm.reshape(t, [8, 8])
The shape of the output Tensor
Round each element in a tensor to the nearest integer. There is a static function version of this method: rint.
$$ x = \begin{cases} \lfloor x \rfloor,& \text{if } x - \lfloor x \rfloor \leq \frac{1}{2}\\ \lceil x \rceil,& \text{otherwise} \end{cases} \forall x \in T $$
const t = sm.randn([128, 128])
// equivalent calls
const a = t.rint()
const b = sm.rint(t)
Calculate the sigmoid (logistic function) for each element in a Tensor. There is a static function version of this method: sigmoid.
$$\frac{1}{1 + e^{-x}} : \forall x \in T$$
const t = sm.randn([1337])
// equivalent calls
const a = t.sigmoid()
const b = sm.sigmoid(t)
Compute the hyperbolic tangent function each element in a tensor. There is a static function version of this method: tanh.
$$\tanh(x) : \forall x \in T$$
const t = sm.randn([128, 128])
// equivalent calls
const a = t.tanh()
const b = sm.tanh(t)
Replicate a Tensor about its axes. There is a static function version of this method: tile.
const t = sm.identity(4)
// equivalent calls
const a = sm.tile(t, [2, 2])
a.shape // [8, 8]
const b = t.tile([2, 2])
b.shape // [8, 8]
// tiling by 1 on all dims does nothing
const no_op = t.tile([1, 1])
A new Tensor
A shape describing the number of iterations to tile each axis.
Re-arrange the layout of the values within a Tensor. There is a static function version of this method: transpose.
The total number of elements of the tensor does not change.
const t = sm.rand([128, 8])
// equivalent calls
const a = t.transpose([1, 0])
a.shape // [8, 128]
const b = sm.transpose(t, [1, 0])
b.shape // [8, 128]
A new Tensor
The new order of the indices of the current axes after tranposing
Generated using TypeDoc
Calculate the absolute value for every element in a Tensor. There is a static function version of this method: absolute.
$$|x| : \forall x \in T$$
Example
Returns