Open
Conversation
…he validator should detect this and check that attribute val rather than pass through silently
b250487 to
2892456
Compare
There was a problem hiding this comment.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/conversion/test_index_bool_split_aten.py 2026-03-18 22:27:08.373651+00:00
+++ /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/conversion/test_index_bool_split_aten.py 2026-03-18 22:27:26.491036+00:00
@@ -4,10 +4,11 @@
1. `index_has_bool_indices` validator correctly distinguishes bool vs int indices.
2. Integer-indexed `aten.index.Tensor` routes to the converter WITHOUT output allocator.
3. Boolean-indexed `aten.index.Tensor` routes to the converter WITH output allocator.
4. Both paths produce correct results.
"""
+
import unittest
from unittest.mock import MagicMock
import torch
import torch.nn as nn
@@ -58,13 +59,11 @@
node = _make_index_node([None, torch.tensor([True, False])])
self.assertTrue(index_has_bool_indices(node))
def test_mixed_int_and_bool_returns_true(self):
"""If any index is bool, the function should return True."""
- node = _make_index_node(
- [torch.tensor([0, 1]), torch.tensor([True, False])]
- )
+ node = _make_index_node([torch.tensor([0, 1]), torch.tensor([True, False])])
self.assertTrue(index_has_bool_indices(node))
def test_all_none_returns_false(self):
node = _make_index_node([None, None])
self.assertFalse(index_has_bool_indices(node))There was a problem hiding this comment.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/conversion/test_index_bool_split_aten.py 2026-03-18 22:27:34.043918+00:00
+++ /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/conversion/test_index_bool_split_aten.py 2026-03-18 22:27:53.739982+00:00
@@ -4,10 +4,11 @@
1. `index_has_bool_indices` validator correctly distinguishes bool vs int indices.
2. Integer-indexed `aten.index.Tensor` routes to the converter WITHOUT output allocator.
3. Boolean-indexed `aten.index.Tensor` routes to the converter WITH output allocator.
4. Both paths produce correct results.
"""
+
import unittest
from unittest.mock import MagicMock
import torch
import torch.nn as nn
@@ -58,13 +59,11 @@
node = _make_index_node([None, torch.tensor([True, False])])
self.assertTrue(index_has_bool_indices(node))
def test_mixed_int_and_bool_returns_true(self):
"""If any index is bool, the function should return True."""
- node = _make_index_node(
- [torch.tensor([0, 1]), torch.tensor([True, False])]
- )
+ node = _make_index_node([torch.tensor([0, 1]), torch.tensor([True, False])])
self.assertTrue(index_has_bool_indices(node))
def test_all_none_returns_false(self):
node = _make_index_node([None, None])
self.assertFalse(index_has_bool_indices(node))There was a problem hiding this comment.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/conversion/test_index_bool_split_aten.py 2026-03-18 22:27:52.852046+00:00
+++ /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/conversion/test_index_bool_split_aten.py 2026-03-18 22:28:13.341265+00:00
@@ -4,10 +4,11 @@
1. `index_has_bool_indices` validator correctly distinguishes bool vs int indices.
2. Integer-indexed `aten.index.Tensor` routes to the converter WITHOUT output allocator.
3. Boolean-indexed `aten.index.Tensor` routes to the converter WITH output allocator.
4. Both paths produce correct results.
"""
+
import unittest
from unittest.mock import MagicMock
import torch
import torch.nn as nn
@@ -58,13 +59,11 @@
node = _make_index_node([None, torch.tensor([True, False])])
self.assertTrue(index_has_bool_indices(node))
def test_mixed_int_and_bool_returns_true(self):
"""If any index is bool, the function should return True."""
- node = _make_index_node(
- [torch.tensor([0, 1]), torch.tensor([True, False])]
- )
+ node = _make_index_node([torch.tensor([0, 1]), torch.tensor([True, False])])
self.assertTrue(index_has_bool_indices(node))
def test_all_none_returns_false(self):
node = _make_index_node([None, None])
self.assertFalse(index_has_bool_indices(node))
zewenli98
approved these changes
Mar 19, 2026
Collaborator
zewenli98
left a comment
There was a problem hiding this comment.
The L0 errors seem not related to this PR. LGTM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
For cases where the index is an attribute of the graph module, t…he validator should detect this and check that attribute val rather than pass through silently
Fixes # (issue)
Type of change
Please delete options that are not relevant and/or add your own.
Checklist: