View source: R/activation_functions.R
softmax_3d | R Documentation |
This function applies the softmax transformation along the third dimension of a 3D array. The softmax function converts raw scores into probabilities such that they sum to 1 for each slice along the third dimension.
softmax_3d(x)
x |
A 3D array. The input array on which the softmax function will be applied. |
The softmax transformation is computed as:
\text{softmax}(x_{ijk}) = \frac{\exp(x_{ijk})}{\sum_{l} \exp(x_{ijl})}
This is applied for each pair of indices (i, j)
across the third dimension (k)
.
The function processes the input array slice-by-slice for the first two dimensions
(i, j)
, normalizing the values along the third dimension (k)
for each slice.
A 3D array of the same dimensions as x
, where the values along the
third dimension are transformed using the softmax function.
# Example: Apply softmax to a 3D array
x <- array(runif(24), dim = c(2, 3, 4)) # Random 3D array (2x3x4)
softmax_result <- softmax_3d(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.