Compute two activation functions for every element of a float array in one kernel launch, with each activation written as its own __device__ function that the kernel calls.
GELU here is the tanh approximation used by GPT-2 and BERT.
Complete:
__device__ functions for the sigmoid and for GELU, each taking and returning a float.__global__ kernel where each thread handles one element (with a bounds check) and writes both sig[i] and gelu[i].void activations(const float* x, float* sig, float* gelu, int n) where all three pointers are host pointers of length n. Allocate, copy in, launch, copy both outputs back and free. n may be 0.Use single-precision math (expf, tanhf, sqrtf) throughout; the tests print 4 decimals. Do not write a main() in your solution.