Conversation
zewenli98
left a comment
There was a problem hiding this comment.
Overall looks good to me. It seems that get_value_by_condition is a helper function. Can you move it to .../dynamo/conversion/converter_utils.py?
| source_ir: Optional[SourceIR], | ||
| name: str, | ||
| input: TRTTensor, | ||
| other: TRTTensor, |
There was a problem hiding this comment.
Does this function support other being a Python float or does it require TRTTensor?
| def get_value_by_condition( | ||
| ctx: ConversionContext, | ||
| target: Target, | ||
| source_ir: Optional[SourceIR], | ||
| name: str, | ||
| input: TRTTensor, | ||
| other: TRTTensor, | ||
| condition: TRTTensor, | ||
| ) -> TRTTensor: | ||
| select_layer = ctx.net.add_select(condition, input, other) | ||
| set_layer_name(select_layer, target, name + "_select", source_ir) | ||
| return select_layer.get_output(0) |
There was a problem hiding this comment.
This can be removed - replace with usage of impl.condition.select, from here:
TensorRT/py/torch_tensorrt/dynamo/conversion/impl/condition/ops.py
Lines 102 to 113 in 76c9ebd
There was a problem hiding this comment.
Alternatively, you may need where:
TensorRT/py/torch_tensorrt/dynamo/conversion/impl/condition/ops.py
Lines 18 to 26 in 76c9ebd
There was a problem hiding this comment.
I removed get_value_by_condition and replaced it with impl.condition.select.
| ) | ||
|
|
||
|
|
||
| @dynamo_tensorrt_converter(torch.ops.aten.atan2.default) |
There was a problem hiding this comment.
If you require one or both input tensors to be TRTTensor, consider using:
TensorRT/py/torch_tensorrt/dynamo/conversion/aten_ops_converters.py
Lines 62 to 66 in 6b8ccbc
There was a problem hiding this comment.
I add enforce_tensor_types for both input and other.
6b8ccbc to
414b806
Compare
I removed |
|
@zewenli98 @gs-olive I've made the changes you suggested. I also noticed I missed the case when input or other is a single constant, so I fixed that using |

Description
New feature to support aten.atan2 converter. I also add test case including edge case for inputs are zero.
Fixes # (issue)
Type of change
Please delete options that are not relevant and/or add your own.
Checklist: