| 20 | } |
| 21 | |
| 22 | void MatrixInverse::canonize_params( |
| 23 | const TensorLayout& layout, size_t* batch, size_t* n) { |
| 24 | megdnn_assert( |
| 25 | layout.ndim >= 2 && layout[layout.ndim - 2] == layout[layout.ndim - 1], |
| 26 | "MatrixInverse: input must be batches of square matrices, but with input " |
| 27 | "layout: %s", |
| 28 | layout.to_string().c_str()); |
| 29 | if (!layout.is_empty()) { |
| 30 | megdnn_assert( |
| 31 | layout.is_contiguous(), |
| 32 | "MatrixInverse: input must be contiguous, but with input layout: %s", |
| 33 | layout.to_string().c_str()); |
| 34 | } |
| 35 | megdnn_assert( |
| 36 | DNN_FLOAT16_SELECT(layout.dtype == dtype::Float16(), false) || |
| 37 | layout.dtype == dtype::Float32(), |
| 38 | "MatrixInverse only supports f16 & f32"); |
| 39 | if (batch) { |
| 40 | *batch = 1; |
| 41 | for (size_t i = 0; i < layout.ndim - 2; ++i) { |
| 42 | *batch *= layout[i]; |
| 43 | } |
| 44 | } |
| 45 | if (n) { |
| 46 | *n = layout[layout.ndim - 1]; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | void MatrixInverse::check_exec( |
| 51 | const TensorLayout& src, const TensorLayout& dst, _megdnn_workspace workspace, |
nothing calls this directly
no test coverage detected