# Interface TensorOpsInterfacePrivate

#### Hierarchy

• TensorOpsInterface

## Methods

• #### Returns Tensor

• 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

  const t = sm.randn([128, 128])  // equivalent calls  const a = t.absolute()  const b = sm.absolute(t)


### Returns

#### Returns Tensor

• 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$$

### Example

  const t = sm.randn([128, 128])  // equivalent calls  const a = t.ceil()  const b = sm.ceil(t)


### Returns

#### Returns Tensor

• Compute the cosine function each element in a tensor. There is a static function version of this method: cos.

$$\cos(x) : \forall x \in T$$

### Example

  const t = sm.randn([128, 128])  // equivalent calls  const a = t.cos()  const b = sm.cos(t)


### Returns

#### Returns Tensor

• Calculate 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$$

### Example

  const t = sm.randn()  // equivalent calls  const a = t.erf()  const b = sm.erf(t)


### Returns

#### Returns Tensor

• Compute the exponential of each element in a tensor. There is a static function version of this method: exp.

$$e^x : \forall x \in T$$

### Example

  const t = sm.randn()  // equivalent calls  const a = t.exp()  const b = sm.exp(t)


### Returns

#### Returns Tensor

• 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$$

### Example

  const t = sm.randn([128, 128])  // equivalent calls  const a = t.floor()  const b = sm.floor(t)


### Returns

#### Returns Tensor

• Compute the natural logarithm of each element in a tensor. There is a static function version of this method: log.

$$\ln(x) : \forall x \in T$$

### Example

  const t = sm.randn()  // equivalent calls  const a = t.log()  const b = sm.log(t)


### Returns

#### Returns Tensor

• 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$$

### Example

  const t = sm.randn()  // equivalent calls  const a = t.log1p()  const b = sm.log1p(t)


### Returns

#### Returns Tensor

• 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$$

### Example

  const t = sm.rand().greaterThan(sm.scalar(0.5))  // equivalent calls  const a = t.logicalNot()  const b = sm.logicalNot(t)


### Returns

• #### Returns Tensor

• Negate a tensor. There is a static function version of this method: negative.

$$-x : \forall x \in T$$

### Example

  const t = sm.randn()  // equivalent calls  const a = t.negative()  const b = sm.negative(t)


### Returns

#### Returns Tensor

• Determine the indices of elements that are non-zero. There is a static function version of this method: nonzero.

### Remarks

Indices correspond to a flattened version of the input tensor.

### Example

  const t = sm.randn()  // equivalent calls  const a = t.nonzero()  const b = sm.nonzero(t)


### Returns

• A new Tensor composed of the flattened indices of the non-zero elements in the input

#### Returns Tensor

• Reshape a Tensor without modifying the underlying data. There is a static function version of this method: reshape.

### Remarks

The resultant shape must contain the same number of elements as the base Tensor.

### Example

  const t = sm.randn()  // equivalent calls  const a = t.reshape([8, 8])  const b = sm.reshape(t, [8, 8])


#### Parameters

• ##### shape: BigInt64Array | number[]

The shape of the output Tensor

#### Returns 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$$

### Example

  const t = sm.randn([128, 128])  // equivalent calls  const a = t.rint()  const b = sm.rint(t)


### Returns

#### Returns Tensor

• 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$$

### Example

  const t = sm.randn()  // equivalent calls  const a = t.sigmoid()  const b = sm.sigmoid(t)


### Returns

• #### Returns Tensor

• Compute the sine function each element in a tensor. There is a static function version of this method: sin.

$$\sin(x) : \forall x \in T$$

### Example

  const t = sm.randn([128, 128])  // equivalent calls  const a = t.sin()  const b = sm.sin(t)


### Returns

#### Returns Tensor

• Compute the square root of each element in a tensor. There is a static function version of this method: sqrt.

$$\sqrt x : \forall x \in T$$

### Example

  const t = sm.randn([128, 128])  // equivalent calls  const a = t.sqrt()  const b = sm.sqrt(t)


### Returns

#### Returns Tensor

• 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$$

### Example

  const t = sm.randn([128, 128])  // equivalent calls  const a = t.tanh()  const b = sm.tanh(t)


### Returns

#### Returns Tensor

• Replicate a Tensor about its axes. There is a static function version of this method: tile.

### Example

  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])


### Returns

A new Tensor

#### Parameters

• ##### shape: BigInt64Array | number[]

A shape describing the number of iterations to tile each axis.

#### Returns Tensor

• Re-arrange the layout of the values within a Tensor. There is a static function version of this method: transpose.

### Remarks

The total number of elements of the tensor does not change.

### Example

  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]


### Returns

A new Tensor

#### Parameters

• ##### axes: BigInt64Array | number[]

The new order of the indices of the current axes after tranposing

#### Returns Tensor

Generated using TypeDoc