| 414 | return (Variable::create(Expr::create(reshape.get(), {x, shape}))); |
| 415 | } |
| 416 | VARP _Scale(VARP x, int channels, std::vector<float>&& scales, std::vector<float>&& bias) { |
| 417 | std::unique_ptr<OpT> scale(new OpT); |
| 418 | scale->type = OpType_Scale; |
| 419 | scale->main.type = OpParameter_Scale; |
| 420 | scale->main.value = new ScaleT; |
| 421 | scale->main.AsScale()->channels = channels; |
| 422 | scale->main.AsScale()->scaleData = std::move(scales); |
| 423 | scale->main.AsScale()->biasData = std::move(bias); |
| 424 | return (Variable::create(Expr::create(std::move(scale), {x}))); |
| 425 | } |
| 426 | /*Given an input value x, it computes the output as x if x > 0 and slope * x if x <= 0. |
| 427 | Args: |
| 428 | x: A variable. |