Given an input value x, it computes the output as x if x > 0 and slope * x if x <= 0. Args: x: A variable. slope: A float, a positive float value, it leakes the negative part by multiplying with `slope` rather than setting it to 0.0f. Returns: output: A variable with the same type as `x`. */
| 431 | output: A variable with the same type as `x`. |
| 432 | */ |
| 433 | VARP _Relu(VARP x, float slope) { |
| 434 | std::unique_ptr<OpT> relu(new OpT); |
| 435 | relu->type = OpType_ReLU; |
| 436 | relu->main.type = OpParameter_Relu; |
| 437 | relu->main.value = new ReluT; |
| 438 | relu->main.AsRelu()->slope = slope; |
| 439 | return (Variable::create(Expr::create(relu.get(), {x}))); |
| 440 | } |
| 441 | /*Given an input value x, it computes Rectified Linear 6: min(max(x, 0), 6). |
| 442 | Args: |
| 443 | x: A variable. |