Description
Outputs outside [lower,upper] have no preimage; lower gives a lower-ray, upper an upper-ray and strict interior a singleton.
Hardtanh clamps its input to supplied lower and upper output bounds. Interior outputs have one preimage, while each saturated endpoint corresponds to an unbounded input ray. An endpoint can have zero excess distance while still being classified as saturated.
Outputs outside [lower,upper] have no preimage; lower gives a lower-ray, upper an upper-ray and strict interior a singleton.
When to use this tool
Use Activation: HardTanh Inverse Preimage when checking the stated clamped-tanh saturation or inverse-region convention.
How to use the tool and how it works
- Enter y, lower, upper. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read result. Expand result to inspect the returned fields.
Require lower<upper. Outputs outside [lower,upper] have no preimage; lower gives a lower-ray, upper an upper-ray and strict interior a singleton. Return y as the boundary marker.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| y | Y | Required. Finite number. |
| lower | Lower | Required. Finite number. |
| upper | Upper | Required. Finite number. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Object containing the operation-specific returned members listed below. | Required. Object. |
| result.hasPreimage | Has Preimage | Calculated result member: boolean. |
| result.kind | Kind | Calculated result member: string. |
| result.boundary | Returned y boundary marker; inspect kind/hasPreimage before interpreting a singleton or ray. | Calculated result member: number. |
{
"input": {
"y": -1,
"lower": -1,
"upper": 1
},
"output": {
"result": {
"hasPreimage": true,
"kind": "lower-ray",
"boundary": -1
}
}
} Limitations and assumptions
- The rays are (-∞,lower] and [upper,∞); boundary is retained even for an empty preimage and must be read with hasPreimage/kind.
- Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use the complete explicit function and the intended parameter, branch and numerical conventions for symbolic, tensor or model-level differentiation; assess training behavior independently.
References
Similar or alternative tools
- HardTanh Saturation Distance
Clamp x into [lower,upper] as nearest; distance=abs(x-nearest), saturated when x<=lower or x>=upper.
- Activation: Leaky ReLU Scalar Inverse Tool
Invert a scalar leaky ReLU with explicitly nonzero negative-branch slope, retaining the two/no-preimage cases for a negative slope rather than claiming a global inverse.