Apply Leaky ReLU to a vector of N float32 values on the GPU.
yi={xiαxixi≥0xi<0Here, x is the input vector, y is the output vector, i is an element index from 0 to N minus 1, and alpha is the supplied nonnegative slope for negative inputs.
Write all N results into the preallocated float32 output device buffer, preserving their order and leaving the input unchanged. The function returns no value.
Input: input = [-2, -1, 0, 1, 2], alpha = 0.1
Output: [-0.2, -0.1, 0.0, 1.0, 2.0]
Explanation: Only the negative values are scaled by 0.1.
Input: input = [-5, 5], alpha = 0.01
Output: [-0.05, 5.0]
Combine the block and thread indices to locate an element.
A conditional expression can select the positive or negative branch.
Check the element index before accessing either buffer.
Accepts: array
Accepts: number
Submit a correct solution to see your kernel performance.
Apply Leaky ReLU to a vector of N float32 values on the GPU.
yi={xiαxixi≥0xi<0Here, x is the input vector, y is the output vector, i is an element index from 0 to N minus 1, and alpha is the supplied nonnegative slope for negative inputs.
Write all N results into the preallocated float32 output device buffer, preserving their order and leaving the input unchanged. The function returns no value.
Input: input = [-2, -1, 0, 1, 2], alpha = 0.1
Output: [-0.2, -0.1, 0.0, 1.0, 2.0]
Explanation: Only the negative values are scaled by 0.1.
Input: input = [-5, 5], alpha = 0.01
Output: [-0.05, 5.0]
Combine the block and thread indices to locate an element.
A conditional expression can select the positive or negative branch.
Check the element index before accessing either buffer.
Accepts: array
Accepts: number
Submit a correct solution to see your kernel performance.