| 314 | } |
| 315 | |
| 316 | void OperatorNodeBase::init_output_format() { |
| 317 | TensorFormat format, default_; |
| 318 | for (auto i : input()) { |
| 319 | auto cur = i->format(); |
| 320 | if (!cur.is_default() && !cur.is_lowbit_aligned()) { |
| 321 | if (format == default_) { |
| 322 | format = cur; |
| 323 | } else { |
| 324 | mgb_assert( |
| 325 | format == cur, |
| 326 | "multiple non-default or non-lowbits aligned " |
| 327 | "formats in inputs: %s vs %s", |
| 328 | format.to_string().c_str(), cur.to_string().c_str()); |
| 329 | } |
| 330 | } |
| 331 | } |
| 332 | for (auto i : output()) { |
| 333 | if (i->contain_flag(VarNode::Flag::VOLATILE_CONTENT)) { |
| 334 | i->format(TensorFormat(i->dtype())); |
| 335 | } else { |
| 336 | if (!format.is_default()) |
| 337 | i->format(format); |
| 338 | else |
| 339 | i->format(TensorFormat(i->dtype())); |
| 340 | } |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | void OperatorNodeBase::init_output_mem_plan(bool dynamic) { |
| 345 | for (auto i : m_output) { |
no test coverage detected