| 166 | } |
| 167 | |
| 168 | void update_layout(const TensorLayout& layout) { |
| 169 | MGB_LOCK_GUARD(lock); |
| 170 | mgb_assert(desc.layout.dtype == layout.dtype, "dtype mismatch"); |
| 171 | mgb_assert(desc.layout.format == layout.format, "format mismatch"); |
| 172 | if (desc.layout.ndim) { |
| 173 | mgb_assert( |
| 174 | desc.layout.eq_shape(layout), "shape infer error, %s vs %s", |
| 175 | desc.layout.to_string().c_str(), layout.to_string().c_str()); |
| 176 | // ignore strides |
| 177 | } else { |
| 178 | static_cast<TensorShape&>(desc.layout) = layout; |
| 179 | desc.layout.init_contiguous_stride(); |
| 180 | } |
| 181 | } |
| 182 | }; |
| 183 | } // namespace interpreter::intl |
| 184 |
no test coverage detected