HardSwish

HardSwish - 22

Version

  • name: HardSwish (GitHub)

  • domain: main

  • since_version: 22

  • function: True

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 22.

Summary

HardSwish takes one input data (Tensor) and produces one output data (Tensor) where the HardSwish function, y = x * max(0, min(1, alpha * x + beta)) = x * HardSigmoid<alpha, beta>(x), where alpha = 1/6 and beta = 0.5, is applied to the tensor elementwise.

Function Body

The function definition for this operator.

<
  domain: "",
  opset_import: ["" : 22]
>
HardSwish (X) => (Y)
{
   HS_X = HardSigmoid <alpha: float = 0.166667, beta: float = 0.5> (X)
   Y = Mul (X, HS_X)
}

Inputs

  • X (heterogeneous) - T:

    Input tensor

Outputs

  • Y (heterogeneous) - T:

    Output tensor

Type Constraints

  • T in ( tensor(bfloat16), tensor(double), tensor(float), tensor(float16) ):

    Constrain input and output types to float tensors.

HardSwish - 14

Version

  • name: HardSwish (GitHub)

  • domain: main

  • since_version: 14

  • function: True

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 14.

Summary

HardSwish takes one input data (Tensor) and produces one output data (Tensor) where the HardSwish function, y = x * max(0, min(1, alpha * x + beta)) = x * HardSigmoid<alpha, beta>(x), where alpha = 1/6 and beta = 0.5, is applied to the tensor elementwise.

Function Body

The function definition for this operator.

<
  domain: "",
  opset_import: ["" : 14]
>
HardSwish (X) => (Y)
{
   HS_X = HardSigmoid <alpha: float = 0.166667, beta: float = 0.5> (X)
   Y = Mul (X, HS_X)
}

Inputs

  • X (heterogeneous) - T:

    Input tensor

Outputs

  • Y (heterogeneous) - T:

    Output tensor

Type Constraints

  • T in ( tensor(double), tensor(float), tensor(float16) ):

    Constrain input and output types to float tensors.