gemini-code-assist[bot] commented on code in PR #19854: URL: https://github.com/apache/tvm/pull/19854#discussion_r3447963384
########## src/relax/op/image/resize.cc: ########## @@ -374,6 +379,8 @@ StructInfo InferStructInfoAffineGrid(const Call& call, const BlockBuilder& ctx) const auto* data_sinfo = GetStructInfoAs<TensorStructInfoNode>(call->args[0]); const auto* size_sinfo = GetStructInfoAs<ShapeStructInfoNode>(call->args[1]); const auto* size_value = call->args[1].as<ShapeExprNode>(); + const auto* attrs = call->attrs.as<AffineGridAttrs>(); + TVM_FFI_ICHECK(attrs) << "Invalid Call"; Review Comment:  To maintain backward compatibility with older IR/models where `affine_grid` did not have attributes, we should not strictly require `attrs` to be non-null. Since `attrs` is not used anywhere else in `InferStructInfoAffineGrid`, we can safely remove these lines. ########## python/tvm/relax/transform/legalize_ops/image.py: ########## @@ -66,6 +66,7 @@ def _image_affine_grid(bb: BlockBuilder, call: Call) -> Expr: topi.image.affine_grid, call.args[0], target_shape=target_shape, + align_corners=call.attrs.align_corners, Review Comment:  If `call.attrs` is `None` (which is the case for older IR/models where `affine_grid` had no attributes), accessing `call.attrs.align_corners` will raise an `AttributeError`. To prevent this and ensure backward compatibility, we should default `align_corners` to `True` if `call.attrs` is `None`. ```suggestion align_corners=call.attrs.align_corners if call.attrs else True, ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
