Spaces:
Running on Zero
Running on Zero
Download continuousintelligence/_vendor/mamba3/utils.py from hugging-apps/ci-proto: direct link, hf CLI and curl.
- Browser
- Download file 638 Bytes
-
https://huggingface.co/spaces/hugging-apps/ci-proto/resolve/main/continuousintelligence/_vendor/mamba3/utils.py
- Command line
-
hf download hf://spaces/hugging-apps/ci-proto/continuousintelligence/_vendor/mamba3/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/hugging-apps/ci-proto/resolve/main/continuousintelligence/_vendor/mamba3/utils.py
638 Bytes
| """Copyright (c) 2025, Dao AI Lab, Goombalab. Apache-2.0; see LICENSE. | |
| Modified by Continuous Intelligence: extracted the inference utility needed by ci-proto. | |
| """ | |
| import triton | |
| import triton.language as tl | |
| def tanh_approx(x): | |
| """ | |
| (Fast) hyperbolic tangent approximation using PTX inline assembly. | |
| Args: | |
| x: Input triton tensor (any shape) in float32 | |
| Returns: | |
| Approximate tanh values in float32 | |
| """ | |
| return tl.inline_asm_elementwise( | |
| "tanh.approx.f32 $0, $1;", | |
| constraints="=f,f", | |
| args=[x], | |
| dtype=tl.float32, | |
| is_pure=True, | |
| pack=1, | |
| ) | |