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

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

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

# add

[common]\
fun [add](add.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)

`add(input: Tensor, other: Tensor, alpha: Double = 1.0, activation: Activation = Activation.IDENTITY)`: the `add` operator. Adds `other` (scaled) to `input` elementwise. Broadcasting and type promotion, the contract every binary op on this surface shares: operand shapes broadcast per the standard rules (trailing dims align; a 1 stretches), and dtypes promote to the dominant operand dtype per the promotion lattice (a scalar `other` keeps its weak kind; an integer literal with an integer tensor stays integral, a double promotes weak-float). The other ops below state &quot;broadcasts and promotes as `add`&quot; instead of restating this.

[common]\
fun [add](add.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)

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

[common]\
fun [add](add.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)

`add(input: Double, other: Tensor, alpha: Double = 1.0, activation: Activation = Activation.IDENTITY)`: the `add` operator. Scalar-LHS . `input` keeps its kind: an integer scalar with an integer tensor stays integral (weak-int promotion); a double promotes weak-float. The parameter set mirrors the tensor-first form: `alpha` scales the TENSOR operand `other`, `activation` applies to the result.