-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Wrap dynamic size handling in a compilation flag #1851
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -270,7 +270,11 @@ auto aten_registrations TORCHTRT_UNUSED = | |
if (tensor_var.isITensor()) { | ||
auto tensor = tensor_var.ITensor(); | ||
if (ctx->input_is_dynamic) { | ||
return dynamic_size_layer(ctx, n, args); | ||
if (ctx->settings.allow_shape_tensors) { | ||
return dynamic_size_layer(ctx, n, args); | ||
} else { | ||
LOG_WARNING("There may be undefined behavior using dynamic shape and aten::size "); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this undefined behavior due to using aten::size with dynamic shape without shape tensors or the other way around. Might need rewording |
||
} | ||
} | ||
return util::toVec(tensor->getDimensions()); | ||
} else if (tensor_var.IValue()->isTensor()) { | ||
|
@@ -286,7 +290,11 @@ auto aten_registrations TORCHTRT_UNUSED = | |
auto dim = args.at(n->input(1)).unwrapToInt(); | ||
if (tensor_var.isITensor()) { | ||
if (ctx->input_is_dynamic) { | ||
return dynamic_size_layer(ctx, n, args); | ||
if (ctx->settings.allow_shape_tensors) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comments here from above about conditions and warnings |
||
return dynamic_size_layer(ctx, n, args); | ||
} else { | ||
LOG_WARNING("There may be undefined behavior using dynamic shape and aten::size "); | ||
} | ||
} | ||
auto tensor = tensor_var.ITensor(); | ||
auto dims = util::toVec(tensor->getDimensions()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be checking if input is dynamic, shape tensors are enabled and the input contains a placeholder dimension before using the shape tensor code path. Otherwise static aten size is sufficient and will cause less errors