Lunderberg commented on code in PR #16209:
URL: https://github.com/apache/tvm/pull/16209#discussion_r1418934749
##########
src/relax/op/tensor/manipulate.cc:
##########
@@ -967,36 +894,22 @@ StructInfo InferStructInfoSplit(const Call& call, const
BlockBuilder& ctx) {
}
// Fall back to unknown shape when the input tensor doesn't have ShapeExpr
as shape.
if (data_shape == nullptr) {
- if (data_sinfo->vdevice.defined()) {
- return TupleStructInfo(Array<StructInfo>(
- n_section,
- TensorStructInfo(data_sinfo->dtype, data_sinfo->ndim,
data_sinfo->vdevice.value())));
- }
- return TupleStructInfo(
- Array<StructInfo>(n_section, TensorStructInfo(data_sinfo->dtype,
data_sinfo->ndim)));
+ return TupleStructInfo(Array<StructInfo>(
+ n_section, TensorStructInfo(data_sinfo->dtype, data_sinfo->ndim,
data_sinfo->vdevice)));
}
ICHECK_NE(axis, -1);
PrimExpr split_len = ceildiv(data_shape->values[axis], n_section);
// Construct struct info for tensors except the last one.
Array<PrimExpr> shape = data_shape->values;
shape.Set(axis, split_len);
- if (data_sinfo->vdevice.defined()) {
- std::vector<StructInfo> output_sinfo(
- n_section - 1,
- TensorStructInfo(ShapeExpr(shape), data_sinfo->dtype,
data_sinfo->vdevice.value()));
- }
- std::vector<StructInfo> output_sinfo(n_section - 1,
- TensorStructInfo(ShapeExpr(shape),
data_sinfo->dtype));
+ std::vector<StructInfo> output_sinfo(
Review Comment:
This is the only location in the PR that should make a change on the
observed behavior. Prior to this commit, whenever `data_sinfo->vdevice` is
defined, the body of the conditional constructed an instance of
`std::vector<StructInfo>`, which is then destructed without being used at the
end of the conditional.
With this commit, the `data_sinfo->device` is propagated to the output,
which I believe to be the intent of the original.
--
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]