|
7 | 7 | import aerosandbox.numpy as _np |
8 | 8 | import casadi as _cas |
9 | 9 | from typing import Literal |
| 10 | +from aerosandbox.numpy.typing import Vectorizable |
10 | 11 |
|
11 | 12 |
|
12 | 13 | def softmax( |
13 | | - *args: float | _np.ndarray, |
| 14 | + *args: Vectorizable, |
14 | 15 | softness: float | None = None, |
15 | 16 | hardness: float | None = None, |
16 | | -) -> float | _np.ndarray: |
| 17 | +) -> Vectorizable: |
17 | 18 | """Compute element-wise soft maximum of two or more arrays. |
18 | 19 |
|
19 | 20 | Also known as the log-sum-exp (LSE) function. Useful for optimization |
@@ -89,10 +90,10 @@ def softmax( |
89 | 90 |
|
90 | 91 |
|
91 | 92 | def softmin( |
92 | | - *args: float | _np.ndarray, |
| 93 | + *args: Vectorizable, |
93 | 94 | softness: float | None = None, |
94 | 95 | hardness: float | None = None, |
95 | | -) -> float | _np.ndarray: |
| 96 | +) -> Vectorizable: |
96 | 97 | """Compute element-wise soft minimum of two or more arrays. |
97 | 98 |
|
98 | 99 | Related to the log-sum-exp function. Useful for optimization because |
@@ -132,10 +133,10 @@ def softmin( |
132 | 133 |
|
133 | 134 |
|
134 | 135 | def softmax_scalefree( |
135 | | - *args: float | _np.ndarray, |
| 136 | + *args: Vectorizable, |
136 | 137 | relative_softness: float | None = None, |
137 | 138 | relative_hardness: float | None = None, |
138 | | -) -> float | _np.ndarray: |
| 139 | +) -> Vectorizable: |
139 | 140 | """Compute scale-free soft maximum of two or more arrays. |
140 | 141 |
|
141 | 142 | Like ``softmax``, but the softness is automatically scaled based on |
@@ -176,10 +177,10 @@ def softmax_scalefree( |
176 | 177 |
|
177 | 178 |
|
178 | 179 | def softmin_scalefree( |
179 | | - *args: float | _np.ndarray, |
| 180 | + *args: Vectorizable, |
180 | 181 | relative_softness: float | None = None, |
181 | 182 | relative_hardness: float | None = None, |
182 | | -) -> float | _np.ndarray: |
| 183 | +) -> Vectorizable: |
183 | 184 | """Compute scale-free soft minimum of two or more arrays. |
184 | 185 |
|
185 | 186 | Like ``softmin``, but the softness is automatically scaled based on |
|
0 commit comments