Download model/activation.py from iaecpsu-1/tdce-basic: direct link, hf CLI and curl.
- Browser
- Download file 300 Bytes
-
https://huggingface.co/iaecpsu-1/tdce-basic/resolve/main/model/activation.py
- Command line
-
hf download hf://iaecpsu-1/tdce-basic/model/activation.py
-
curl -L -o activation.py https://huggingface.co/iaecpsu-1/tdce-basic/resolve/main/model/activation.py
300 Bytes
| alpha = 0.1 | |
| def leaky_relu(x): | |
| shape = x.shape | |
| x = x.flatten() | |
| result = 0 | |
| if x > 0: | |
| result = x | |
| else: | |
| result = alpha * x | |
| return result.reshape(shape) | |
| def leaky_relu_prime(x): | |
| x = x.flatten() | |
| if x > 0: | |
| return 1 | |
| else: | |
| return alpha | |