---
title: "sub"
sidebar_label: "sub"
description: "Kotlin binding reference: sub."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[Ops](index.md)/[sub](sub.md)

# sub

[common]\
fun [sub](sub.md)(input: [Tensor](../Tensor/index.md), other: [Tensor](../Tensor/index.md), alpha: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) = 1.0, activation: [Activation](../Activation/index.md) = Activation.IDENTITY): [Tensor](../Tensor/index.md)

`sub(input: Tensor, other: Tensor, alpha: Double = 1.0, activation: Activation = Activation.IDENTITY)`: the `sub` operator. Subtracts `other` (scaled) from `input` elementwise. Broadcasts and promotes as `add`; `alpha` (default `1.0`) scales `other` before the subtract, and `activation` is the same fused float-only epilogue (default `Activation::Identity`).

[common]\
fun [sub](sub.md)(input: [Tensor](../Tensor/index.md), other: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html), alpha: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) = 1.0, activation: [Activation](../Activation/index.md) = Activation.IDENTITY): [Tensor](../Tensor/index.md)

`sub(input: Tensor, other: Double, alpha: Double = 1.0, activation: Activation = Activation.IDENTITY)`: the number form of `sub`, `other` as a scalar.

[common]\
fun [sub](sub.md)(input: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html), other: [Tensor](../Tensor/index.md), alpha: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) = 1.0, activation: [Activation](../Activation/index.md) = Activation.IDENTITY): [Tensor](../Tensor/index.md)

`sub(input: Double, other: Tensor, alpha: Double = 1.0, activation: Activation = Activation.IDENTITY)`: the `sub` operator. Scalar-LHS . `input` keeps its kind (see `Scalar`). The parameter set mirrors the tensor-first form: `alpha` scales the TENSOR operand `other`, `activation` applies to the result.