Computes softmax activations. Args: logits: A non-empty variable. Must be Halide_Type_Float. axis: The dimension softmax would be performed on. The default is -1 which indicates the last dimension. Returns: output: A variable with the same type as `logits`. */
| 477 | output: A variable with the same type as `logits`. |
| 478 | */ |
| 479 | VARP _Softmax(VARP logits, int axis) { |
| 480 | std::unique_ptr<OpT> softmax(new OpT); |
| 481 | softmax->type = OpType_Softmax; |
| 482 | softmax->main.type = OpParameter_Axis; |
| 483 | softmax->main.value = new AxisT; |
| 484 | softmax->main.AsAxis()->axis = axis; |
| 485 | return (Variable::create(Expr::create(softmax.get(), {logits}))); |
| 486 | } |
| 487 | /*Computes softplus: log(exp(features) + 1). |
| 488 | Args: |
| 489 | features: A variable. Must be Halide_Type_Float. |