-
Notifications
You must be signed in to change notification settings - Fork 363
fix: replace add_identity by add_cast for type cast #3563
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -909,7 +909,6 @@ def type_cast( | |
""" | ||
This function helps to cast the input type to cast_type | ||
""" | ||
layer_i = network.add_identity(input) | ||
layer_i.set_output_type(0, cast_type) | ||
layer_i = network.add_cast(input, cast_type) | ||
set_layer_name(layer_i, target, f"{name}_dtype_change") | ||
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. Thanks for the quick change @junstar92. LGTM as such. Just a minor change, since now we use the
to something like
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. Thanks for the feedback. I updated the comment for |
||
return layer_i.get_output(0) |
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.
Can you use the
cast_trt_tensor
function to this instead ?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.
This is a patch for FX, but looks like
cast_trt_tensor
is only in dynamo?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.
@peri044 As @zewenli98 mentioned,
cast_trt_tensor
is in Dynamo path. So it needs to importdynamo.conversion.converter_utils
in FX path. It this what you intended? If not, would you prefer me to implementcast_trt_tensor
just like in Dynamo path and use it instead oftype_cast
?