MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / check_layout

Method check_layout

src/core/impl/graph/var_node_mem_mgr.cpp:1158–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1156}
1157
1158bool 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
1180void VarNodeMemManager::fwd_in2out_writable(VarNode* src, VarNode* dest) {
1181 /*

Callers 3

ensure_input_layoutMethod · 0.45
fwd_in2out_readonlyMethod · 0.45
fwd_in2out_writableMethod · 0.45

Calls 2

is_contiguousMethod · 0.45

Tested by

no test coverage detected