Skip to content

Commit

Permalink
Add type ignore and pylint disable comments
Browse files Browse the repository at this point in the history
  • Loading branch information
justinchuby authored Dec 31, 2024
1 parent b6792e2 commit b346e2c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion onnxscript/ir/_convenience.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def tensor(
elif str(type(value)) == "<class 'torch.Tensor'>":
# NOTE: We use str(type(...)) and do not import torch for type checking
# as it creates overhead during import
return tensor_adapters.TorchTensor(value, name=name, doc_string=doc_string)
return tensor_adapters.TorchTensor(value, name=name, doc_string=doc_string) # type: ignore[arg-type]
elif isinstance(value, (_protocols.DLPackCompatible, _protocols.ArrayCompatible)):
return _core.Tensor(value, dtype=dtype, name=name, doc_string=name)

Expand Down
2 changes: 1 addition & 1 deletion onnxscript/ir/_convenience_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class ConvenienceTest(unittest.TestCase):
def test_tensor_accepts_torch_tensor(self):
import torch as some_random_name
import torch as some_random_name # pylint: disable=import-outside-toplevel

torch_tensor = some_random_name.tensor([1, 2, 3])
tensor = _convenience.tensor(torch_tensor)
Expand Down

0 comments on commit b346e2c

Please # to comment.