---
title: "ClikaRT::nn::Sub"
sidebar_label: "Sub"
description: "Subtracts other, scaled by alpha, from input elementwise with broadcasting: input - alpha * other, then the optional fused activation."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--class">class</span>

**Header:** `ClikaRT/nn/generated/elementwise.h`  
**Inherits:** [`ClikaRT::nn::Module`](./Module.md)

Subtracts `other`, scaled by alpha, from `input` elementwise with broadcasting: input - alpha \* other, then the optional fused activation. The module form of [`ClikaRT::ops::sub`](../ops/sub.md#sub), which documents the full contract (shapes, dtypes, errors); construct once, then call it like a function.

## Member functions

### Sub() {#Sub}

<div class="api-signature">

`explicit` **`Sub`**([`SubOptions`](./SubOptions.md) `options` `=` `{}`)

</div>

Constructs the module from [`options`](./Sub.md#options) (every default when omitted).

<div class="api-declared">

Declared in `ClikaRT/nn/generated/elementwise.h`, line 118

</div>

### forward() {#forward}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`forward`**([`Tensor`](../Tensor.md) `input`, [`ScalarOrTensor`](../ScalarOrTensor.md) `other`) `const`

</div>

[`forward_impl`](./Sub.md#forward), unwrapped: raises [`ClikaRT::Error`](../Error.md) on failure.

<div class="api-declared">

Declared in `ClikaRT/nn/generated/elementwise.h`, line 132

</div>

### operator()() {#operator-call}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`operator()`**([`Tensor`](../Tensor.md) `input`, [`ScalarOrTensor`](../ScalarOrTensor.md) `other`) `const`

</div>

Same as [`forward`](./Sub.md#forward).

<div class="api-declared">

Declared in `ClikaRT/nn/generated/elementwise.h`, line 136

</div>

### options() {#options}

<div class="api-signature">

`const` [`SubOptions`](./SubOptions.md)`&` **`options`**() `const`

</div>

The settings this module was constructed with.

<div class="api-declared">

Declared in `ClikaRT/nn/generated/elementwise.h`, line 140

</div>
