Skip to main content

ClikaRT::ops::hardswish

function

hardswish()

Tensor hardswish(Tensor x)

Piecewise-linear swish approximation (the MobileNet-v3 form).

hardswish(x)=xclamp ⁣(x6+12,  0,  1)\mathrm{hardswish}(x) = x \cdot \mathrm{clamp}\!\bigl(\tfrac{x}{6} + \tfrac{1}{2},\; 0,\; 1\bigr)

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 x.

auto y = ClikaRT::ops::hardswish(x);

Declared in ClikaRT/compute/ops.h, line 851