Tensara Logo

tensara

ProblemsLeaderboardsBlog

ReLU

EASY

Perform the ReLU (Rectified Linear Unit) activation function on an input matrix:

C[i][j]=max(0,A[i][j])C[i][j] = \max(0, A[i][j])

The ReLU function is defined as:

f(x)={xif x>00if x0f(x) = \begin{cases} x & \text{if } x > 0 \\ 0 & \text{if } x \leq 0 \end{cases}

Input:

  • Matrix AA of size M×NM \times N containing floating-point values

Output:

  • Matrix CC of size M×NM \times N containing the ReLU activation values

Notes:

  • Both matrices A\text{A} and C\text{C} are stored in row-major order

Desktop Required for Code Submission

For the best coding experience, please switch to a desktop device to write and submit your solution.

GPU Type

Language

Data Type

Loading...