Floor at Zero
Return x with every negative element replaced by 0. The other elements stay as they are. Networks do this between their layers, under the name ReLU.
Example 1
x [1.5,-2.0,0.0,3.0]
returns [1.5,0.0,0.0,3.0]
Constraints
xhas 1 or 2 dimensions
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More PyTorch problems
- Matrix Times MatrixEasy
- One HotEasy
- Only the PositivesEasy
- Rows That Sum to OneEasy
- Stack the RowsEasy
- The First GradientEasy
- The k LargestEasy
- A Moving AverageMedium