Copies a variable setting everything outside a central band in each innermost matrix. Arguments: input: Rank k variable. num_lower: Number of subdiagonals to keep. If negative, keep entire lower triangle. num_upper: Number of superdiagonals to keep. If negative, keep entire upper triangle. Returns: Output: Rank k variable of the same shape as input. The extracted banded tensor. */
| 1105 | Output: Rank k variable of the same shape as input. The extracted banded tensor. |
| 1106 | */ |
| 1107 | VARP _MatrixBandPart(VARP input, VARP num_lower, VARP num_upper) { |
| 1108 | std::unique_ptr<OpT> op(new OpT); |
| 1109 | op->type = OpType_MatrixBandPart; |
| 1110 | op->main.type = OpParameter_NONE; |
| 1111 | return (Variable::create(Expr::create(std::move(op), {input, num_lower, num_upper}))); |
| 1112 | } |
| 1113 | /*Calculates the mean and variance of x. |
| 1114 | Args: |
| 1115 | x: A variable. must be 4-D with NC4HW4 format. |