return x such that shape_of(var) == x
| 46 | #if !MGB_BUILD_SLIM_SERVING |
| 47 | // return x such that shape_of(var) == x |
| 48 | GetVarShape* get_shape_shortcut(VarNode* var) { |
| 49 | auto opr = var->owner_opr(); |
| 50 | auto otype = opr->dyn_typeinfo(); |
| 51 | if (!(otype == Reshape::typeinfo() && |
| 52 | opr->cast_final<Reshape>().param().axis == OptionalAxis::INVALID_AXIS) && |
| 53 | otype != Broadcast::typeinfo()) { |
| 54 | return nullptr; |
| 55 | } |
| 56 | auto i1 = opr->input(1)->owner_opr(); |
| 57 | if (i1->same_type<GetVarShape>()) |
| 58 | return &i1->cast_final<GetVarShape>(); |
| 59 | return nullptr; |
| 60 | } |
| 61 | #endif |
| 62 | } // anonymous namespace |
| 63 | // f}}} |