| 5 | |
| 6 | template <int arity> |
| 7 | void ElemwiseOpParamN<arity>::init_from_given_tensor() { |
| 8 | megdnn_assert(!size && max_ndim == -1); |
| 9 | max_ndim = 0; |
| 10 | for (int i = 0; i < arity; ++i) { |
| 11 | TensorLayout& layout = param[i].layout; |
| 12 | layout = layout.collapse_contiguous(); |
| 13 | auto cur = layout.total_nr_elems(); |
| 14 | if (!i) { |
| 15 | size = cur; |
| 16 | } else { |
| 17 | megdnn_assert(size == cur); |
| 18 | } |
| 19 | max_ndim = std::max<int>(max_ndim, layout.ndim); |
| 20 | } |
| 21 | megdnn_assert(size > 0 && max_ndim > 0); |
| 22 | } |
| 23 | |
| 24 | template <int arity> |
| 25 | void ElemwiseOpParamN<arity>::assert_initialized() const { |
no test coverage detected