---
title: "ClikaRT::ops::softmin"
sidebar_label: "softmin"
description: "Softmax of the negated input: weights small values highest. \\[ \\mathrm{softmin}(x) = \\mathrm{softmax}(-x) \\quad \\text{along } \\mathit{dim} \\] input the input tensor. dim the reduction dimension."
---

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

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

## softmin() {#softmin}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`softmin`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`int64_t` `dim` `=` `-1`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`DataType`](../../index.md#DataType) `dtype` `=` [`DataType::Undefined`](../../index.md#DataType)<br />
)

</div>

Softmax of the negated input: weights small values highest.

$$
\mathrm{softmin}(x) = \mathrm{softmax}(-x) \quad \text{along } \mathit{dim}
$$

**Parameters**

- `input`: the input tensor.
- `dim`: the reduction dimension. Negative counts from the end. Default `-1`.
- `dtype`: output dtype; [`DataType::Undefined`](../../index.md#DataType) (default) keeps `input`'s.

**Throws**

- `ClikaRT::Error`: when `dim` is out of range, or when the dtype pair is not served (`code_name()` carries the reason).

**Returns:** same shape as `input`; dtype = [`dtype`](../dtype/index.md) when set, else `input`'s.

```cpp
auto w = ClikaRT::ops::softmin(distances, -1);
```

<div class="api-declared">

Declared in `ClikaRT/compute/ops.h`, line 1079

</div>
