bool copy_shapedata(const loco::Node *src, loco::Node *dst)
{
// if dst already has ShapeInferenceData, skip
- auto dst_shapedata = dst->annot<ShapeInferenceData>();
- if (dst_shapedata != nullptr)
+ if (shape_inference_done(dst))
return false;
// if src has loco::NodeShape, use it
}
// if src doesn't have ShapeInferenceData, skip
- auto src_shapedata = src->annot<ShapeInferenceData>();
- if (src_shapedata == nullptr)
+ if (!shape_inference_done(src))
return false;
+ auto src_shapedata = src->annot<ShapeInferenceData>();
auto shape_data = make_shape_inference_data(src_shapedata);
dst->annot(std::move(shape_data));
return true;
}
- auto shapedata = node->annot<ShapeInferenceData>();
- if (shapedata == nullptr)
- {
+ if (!shape_inference_done(node))
return false;
- }
+
+ auto shapedata = node->annot<ShapeInferenceData>();
switch (shapedata->domain())
{