generated from kyegomez/Python-Package-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kye
committed
Nov 7, 2023
1 parent
21cdfd2
commit aa061f2
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
from mpl_toolkits.mplot3d import Axes3D | ||
|
||
# SiLU (Sigmoid-weighted Linear Unit) activation function | ||
def silu(x): | ||
return x * (1 / (1 + np.exp(-x))) | ||
|
||
# Generate inputs and calculate SiLU outputs | ||
input_values = np.linspace(-10, 10, 100) | ||
output_values = silu(input_values) | ||
|
||
# Create 3D plot | ||
fig = plt.figure() | ||
ax = fig.add_subplot(111, projection='3d') | ||
|
||
# Scatter plot of SiLU outputs | ||
ax.scatter(input_values, output_values, input_values, c=output_values, cmap='viridis') | ||
ax.set_xlabel('Input') | ||
ax.set_ylabel('Output') | ||
ax.set_zlabel('Input') | ||
ax.set_title('3D Visualization of SiLU Activation Function') | ||
|
||
plt.show() |