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

Method add_input_layout_constraint

src/opr/impl/tensor_manip.cpp:274–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274void ReshapeBrdcastHelper::add_input_layout_constraint() {
275 if (!cg::is_static_var_value(input(1)))
276 return;
277
278 auto check_layout = [this](const TensorLayout& layout) {
279 MGB_TRY {
280 TensorShape oshp;
281 outshape_by_symvar_do_get_output_shape(
282 oshp, outshape_by_symvar_get_shape_infer_info());
283 return reshapebrdcast_get_dest_layout(layout, oshp).valid();
284 }
285 MGB_CATCH(MegBrainError & exc, {
286 if (!exc.extra_info())
287 cg::OperatorNodeExcExtraInfo::record(this, exc);
288 throw;
289 })
290 };
291 input(0)->add_layout_constraint(check_layout);
292}
293
294void ReshapeBrdcastHelper::init_output_static_infer_desc() {
295 Super::init_output_static_infer_desc();

Callers

nothing calls this directly

Calls 6

is_static_var_valueFunction · 0.85
extra_infoMethod · 0.80
add_layout_constraintMethod · 0.80
MGB_CATCHFunction · 0.50
validMethod · 0.45
comp_nodeMethod · 0.45

Tested by

no test coverage detected