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

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

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

# hardtanh

[common]\
fun [hardtanh](hardtanh.md)(input: [Tensor](../Tensor/index.md), minVal: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) = -1.0, maxVal: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) = 1.0): [Tensor](../Tensor/index.md)

`hardtanh(input: Tensor, minVal: Double = -1.0, maxVal: Double = 1.0)`: the `hardtanh` operator. Clamps every element to `[min_val, max_val]`.