| 1156 | } |
| 1157 | |
| 1158 | bool VarNodeMemManager::VarNodeMemTrait::check_layout( |
| 1159 | const TensorLayout& layout) const { |
| 1160 | switch (layout_constraint.level) { |
| 1161 | case LayoutConstraintLevel::CONTIG: |
| 1162 | return layout.is_contiguous(); |
| 1163 | case LayoutConstraintLevel::MONOTONE: |
| 1164 | if (!layout.is_abs_monotonous_allow_brdcst()) { |
| 1165 | return false; |
| 1166 | } |
| 1167 | break; |
| 1168 | case LayoutConstraintLevel::NONE: |
| 1169 | break; |
| 1170 | default: |
| 1171 | mgb_throw(InternalError, "invalid layout_constraint_level"); |
| 1172 | } |
| 1173 | |
| 1174 | for (auto&& i : layout_constraint.custom) |
| 1175 | if (!i(layout)) |
| 1176 | return false; |
| 1177 | return true; |
| 1178 | } |
| 1179 | |
| 1180 | void VarNodeMemManager::fwd_in2out_writable(VarNode* src, VarNode* dest) { |
| 1181 | /* |
no test coverage detected