onnxruntime/js/web/lib/wasm/jsep/webgpu/ops
Jiajie Hu 5b06505073
[js/webgpu] Fix Tanh explosion (#19201)
### Description
```math
\tanh(x)=\frac{e^x-e^{-x}}{e^x+e^{-x}}=
\left\{
\begin{array}{cc}
-\frac{1-e^{-2\cdot(-x)}}{1+e^{-2\cdot(-x)}}, & x<0 \\
0, & x=0 \\
\frac{1-e^{-2x}}{1+e^{-2x}}, & x>0
\end{array}
\right.
```

### Motivation and Context
On some platforms,
$$\tanh(1000)=\frac{e^{1000}-e^{-1000}}{e^{1000}+e^{-1000}}$$ would
produce NaN instead of 0.999... or 1 (imagine $e^{1000}=\infty$ and
$\frac{\infty}{\infty}$ explodes).
2024-01-25 08:25:35 -08:00
..
3rd-party [js/webgpu] Fix f16 errors for ConvTranspose2D (#18986) 2024-01-04 08:06:01 -08:00
argminmax.ts [JS/Web] Added uniforms to Reduce, Resize and Split Ops. (#18727) 2023-12-12 11:12:23 -08:00
attention.ts [js/webgpu] Support uniforms for attention and multihead attention (#18903) 2024-01-09 07:46:30 -08:00
batch-norm.ts [js/webgpu] Change A/sqrt(B) to A*inverseSqrt(B) in normalization ops (#19101) 2024-01-12 00:08:16 -08:00
bias-add.ts [js/webgpu] revise uniform support (#17871) 2023-10-11 16:41:46 -07:00
bias-split-gelu.ts [JS/Web] Resize & BiasSplitGelu fp16 support (#18536) 2023-11-22 12:12:07 -08:00
binary-op.ts [js/webgpu] Optimize broadcast binary. (#18185) 2023-11-20 16:52:17 -08:00
common.ts [js/webgpu] Support uniforms for attention and multihead attention (#18903) 2024-01-09 07:46:30 -08:00
concat.ts [js/webgpu] Add uniforms support to concat op (#18238) 2023-11-10 13:46:03 -08:00
conv-grouped.ts [js/webgpu] Provide a vectorized algorithm for GroupedConv (#18884) 2024-01-10 16:12:43 -08:00
conv-transpose.ts [js/webgpu] Use the naive convTranspose when in/out channels are both 1 (#18658) 2023-12-04 13:18:37 -08:00
conv.ts [js/webgpu] disable GroupedConvVectorize path (#19090) 2024-01-11 08:13:14 -08:00
cumsum.ts [JS/Web] Added uniforms to Reduce, Resize and Split Ops. (#18727) 2023-12-12 11:12:23 -08:00
einsum.ts [JS/Web] Add uniforms to Einsum (#18531) 2023-11-29 15:30:33 -08:00
expand.ts [js/webgpu] Fix Expand/Gather when input type is bool (#18999) 2024-01-05 08:16:15 -08:00
fuse-utils.ts [js/webgpu] Fix conv2d with activation (#18388) 2023-11-10 12:54:35 -08:00
gather-elements.ts [JS/Web] AddedUniforms in GatherElements. (#18670) 2023-12-05 09:19:53 -08:00
gather.ts [js/webgpu] Fix Expand/Gather when input type is bool (#18999) 2024-01-05 08:16:15 -08:00
gemm.ts fix gemm beta for fp16 (#19153) 2024-01-15 18:40:38 -08:00
instance-norm.ts [js/webgpu] Change A/sqrt(B) to A*inverseSqrt(B) in normalization ops (#19101) 2024-01-12 00:08:16 -08:00
layer-norm.ts [js/webgpu] Change A/sqrt(B) to A*inverseSqrt(B) in normalization ops (#19101) 2024-01-12 00:08:16 -08:00
matmul.ts [js/webgpu] Provide a naive vectorized matmul algorithm (#18758) 2023-12-13 09:03:23 -08:00
multi-head-attentiion.ts [js/webgpu] Support uniforms for attention and multihead attention (#18903) 2024-01-09 07:46:30 -08:00
pad.ts [js/webgpu] Support pad uniforms (#19057) 2024-01-09 09:34:56 -08:00
pool.ts [js/webgpu] Refactor attributes of pool (#18728) 2023-12-26 17:23:52 -08:00
range.ts [js/webgpu] Support range uniforms (#19055) 2024-01-09 09:33:57 -08:00
reduce-shared.ts [JS/WebGPU] fix an error in Clip (#18799) 2023-12-19 13:51:01 -08:00
reduce.ts [JS/Web] Added uniforms to Reduce, Resize and Split Ops. (#18727) 2023-12-12 11:12:23 -08:00
resize.ts fix resize for fp16 (#19110) 2024-01-12 13:44:28 -08:00
skip-layer-norm.ts [JS/WebGPU] Added Uniforms to SkipLayerNorm. (#18788) 2024-01-25 01:12:21 +05:30
slice.ts [JS/Web] Added uniforms to Reduce, Resize and Split Ops. (#18727) 2023-12-12 11:12:23 -08:00
softmax.ts [JS/WebGPU] fix an error in Clip (#18799) 2023-12-19 13:51:01 -08:00
split.ts [JS/Web] Added uniforms to Reduce, Resize and Split Ops. (#18727) 2023-12-12 11:12:23 -08:00
tile.ts [JS/WebGPU] Added uniforms to Tile and Where Ops (#18768) 2023-12-11 20:58:52 -08:00
transpose.ts [js/webgpu] Fix the transpose error when dims > 4D (#18027) 2023-10-23 11:02:19 -07:00
unary-op.ts [js/webgpu] Fix Tanh explosion (#19201) 2024-01-25 08:25:35 -08:00
where.ts [js/webgpu] fix bcast in where (#19009) 2024-01-11 12:13:24 -08:00