---
title: "ClikaRT::ops::neg"
sidebar_label: "neg"
description: "Elementwise negation. \\[ -x_i \\] Value-domain violations follow IEEE semantics (NaN / ±inf in the result), never an error."
---

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

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

## neg() {#neg}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`neg`**([`Tensor`](../Tensor.md) `input`)

</div>

Elementwise negation.

$$
-x_i
$$

Value-domain violations follow IEEE semantics (NaN / ±inf in the result), never an error.

**Throws**

- `ClikaRT::Error`: when the input's dtype is not served for this operation (the machine-readable reason rides `code_name()`).

**Returns:** a new tensor, same shape and dtype as `input`.

```cpp
auto y = ClikaRT::ops::neg(x);
```

<div class="api-declared">

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

</div>
